icons.adoc 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. [#icons]
  2. = Icons
  3. You can specify any HTML for an icon. It's a popular choice to use Unicode
  4. icons because they are extremely fast to load and there are a lot of them,
  5. but OliveTin also support Iconify, and simple PNG, JPG, WEBP and similar images.
  6. .Examples of icons in OliveTin
  7. image::../exampleIcons.png[]
  8. For a quick reference, here are some examples of how to use different types of icons in OliveTin;
  9. .`config.yaml`
  10. ```yaml
  11. include::example$action_customization/icons/config.yaml[]
  12. ```
  13. == Iconify Icons
  14. Browse over 200,000 icons that can be used with OliveTin here; https://icon-sets.iconify.design/
  15. Note, the icons are loaded from the internet, but should be cached by your browser afer the first load.
  16. On the Iconfiy website, you should select **Iconify Icon**
  17. image::../iconify.png[]
  18. Then copy this icon code, and place it in your config;
  19. [source,yaml]
  20. .`config.yaml`
  21. ----
  22. actions:
  23. - title: Iconify Icon
  24. icon: <iconify-icon icon="ant-design:bug-filled"></iconify-icon>
  25. ----
  26. And you should get something that looks like this;
  27. image::../action-button-iconify.png[]
  28. == Default Icon (bundled HugeIcon)
  29. OliveTin used to use a default emoji smiley face as the default icon for actions, but that was a bit too "emoji" and not everyone liked it. Now, OliveTin uses a simple "command line" icon from the HugeIcons set as the default icon for actions. This is a simple and neutral icon that should work well for most actions.
  30. If you need to reset a default icon for some reason, this is how you can do it;
  31. .`config.yaml`
  32. ----
  33. actions:
  34. - title: Action with the bundled CLI HugeIcon
  35. icon: hugeicons:CommandLineIcon
  36. shell: echo hello
  37. ----
  38. If you want to use other icons from the HugeIcons set, you need to use the Iconify method described above, not with the "hugeicons:" prefix - that only works for the default icon.
  39. == Unicode icons ("emoji")
  40. Using simple emoji (unicode) icons from your browser's font is extremely fast, and can look good on some platforms. However, the icons are platform specific, which mean's they'll look different between browsers and between operating systems.
  41. There are great sites like link:https://symbl.cc/en/emoji/[symbl.cc - a list of
  42. "Emoji" in unicode].
  43. For example, if you find "link:https://symbl.cc/en/1F60E/[Smiling face with sunglasses]" you can click
  44. on it to see it's "HTML-code". In OliveTin, you'd setup the icon like this;
  45. ----
  46. actions:
  47. - title: Unicode (emoji) icon
  48. icon: "&#128526;"
  49. shell: echo "You are awesome"
  50. ----
  51. === Unicode aliases
  52. OliveTin has hard-coded aliases for a few commonly used icons, so you don't have to type out the full unicode codes. A list of those hard coded icons is;
  53. .Alias'd unicode reference table
  54. [%header]
  55. |===
  56. | Alias | Rendered as
  57. | `poop` | &#x1f4a9;
  58. | `smile` | &#x1F600;
  59. | `ping` | &#x1f4e1;
  60. | `backup` | &#128190;
  61. | `reboot` | &#128260;
  62. | `restart` | &#128260;
  63. | `box` | &#128230;
  64. | `ashtonished` | &#128562;
  65. | `clock` | &#128338;
  66. | `disk` | &#128189;
  67. | `logs` | &#128269;
  68. | `light` | &#128161;
  69. | `robot` | &#129302;
  70. | `ssh` | &#128272;
  71. | `theme` | &#127912;
  72. |===
  73. A full reference can be found in: https://github.com/OliveTin/OliveTin/blob/main/service/internal/config/emoji.go
  74. == Full HTML icons (`<img src ...`)
  75. You can also specify the full HTML for an image, like;
  76. ----
  77. actions:
  78. - title: HTML (jpg/png/etc) icon
  79. icon: '<img src = "https://www.docker.com/sites/default/files/d8/2019-07/vertical-logo-monochromatic.png" width = "48px"/>'
  80. shell: docker ps
  81. ----
  82. === Saving and serving icons for "offline" use
  83. Sometimes you might want to store images to use as icons, with your installation of OliveTin. This can be useful when your installation is meant to be offline, or disconnected from the internet. This is easily done.
  84. OliveTin will try to create a directory called `custom-webui` in the same directory as the `config.yaml` file. If this directory exists, OliveTin will serve files from this directory as if they were in the standard webui directory, in the same path as your OliveTin web UI.
  85. Ideally, put your icons in a directory like `<your-config-dir>/custom-webui/icons/`. If this directory contained a file called "mrgreen.gif", then it would be served at `http://myserver:1337/custom-webui/icons/mrgreen.gif`. Below is a picture of Mr Green. Feel free to save his likeness and awesomeness for yourself, for future awesome offline usage.
  86. .Mr Green, the original awesome smily.
  87. image::../mrgreen.gif[Mr Green]
  88. In your OliveTin config, customize your command again using HTML, like this;
  89. ----
  90. actions:
  91. - title: Mr Green
  92. icon: '<img src = "custom-webui/icons/mrgreen.gif" />'
  93. shell: echo "I don't like the word 'emoji' "
  94. ----
  95. This will result in a locally hosted icon that will work offline, that looks like this;
  96. image::../mrGreenAction.png[]
  97. ////
  98. = CSS styles
  99. OliveTin allows you to write any CSS style rules directly on a single action.
  100. This is both pretty powerful if you want an action to have a particular style,
  101. but it does require understanding that you are writing your code - and can
  102. break things! Be careful!
  103. A tutorial on how to use CSS can easily be found online, but here are some
  104. examples;
  105. == Example: Bold & Purple action
  106. ----
  107. - actions:
  108. - title: My special action
  109. css:
  110. background-color: purple
  111. font-weight: bold
  112. shell: echo "I like purple"
  113. ----
  114. ////