icons.adoc 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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. == Unicode icons ("emoji")
  29. 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.
  30. There are great sites like link:https://symbl.cc/en/emoji/[symbl.cc - a list of
  31. "Emoji" in unicode].
  32. For example, if you find "link:https://symbl.cc/en/1F60E/[Smiling face with sunglasses]" you can click
  33. on it to see it's "HTML-code". In OliveTin, you'd setup the icon like this;
  34. ----
  35. actions:
  36. - title: Unicode (emoji) icon
  37. icon: "&#128526;"
  38. shell: echo "You are awesome"
  39. ----
  40. === Unicode alises
  41. 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;
  42. .Alias'd unicode reference table
  43. [%header]
  44. |===
  45. | Alias | Rendered as
  46. | `poop` | &#x1f4a9;
  47. | `smile` | &#x1F600;
  48. | `ping` | &#x1f4e1;
  49. | `backup` | &#128190;
  50. | `reboot` | &#128260;
  51. | `restart` | &#128260;
  52. | `box` | &#128230;
  53. | `ashtonished` | &#128562;
  54. | `clock` | &#128338;
  55. | `disk` | &#128189;
  56. | `logs` | &#128269;
  57. | `light` | &#128161;
  58. | `robot` | &#129302;
  59. | `ssh` | &#128272;
  60. | `theme` | &#127912;
  61. |===
  62. A full reference can be found in: https://github.com/OliveTin/OliveTin/blob/main/service/internal/config/emoji.go
  63. == Full HTML icons (`<img src ...`)
  64. You can also specify the full HTML for an image, like;
  65. ----
  66. actions:
  67. - title: HTML (jpg/png/etc) icon
  68. icon: '<img src = "https://www.docker.com/sites/default/files/d8/2019-07/vertical-logo-monochromatic.png" width = "48px"/>'
  69. shell: docker ps
  70. ----
  71. === Saving and serving icons for "offline" use
  72. 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.
  73. 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.
  74. 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.
  75. .Mr Green, the original awesome smily.
  76. image::../mrgreen.gif[Mr Green]
  77. In your OliveTin config, customize your command again using HTML, like this;
  78. ----
  79. actions:
  80. - title: Mr Green
  81. icon: '<img src = "custom-webui/icons/mrgreen.gif" />'
  82. shell: echo "I don't like the word 'emoji' "
  83. ----
  84. This will result in a locally hosted icon that will work offline, that looks like this;
  85. image::../mrGreenAction.png[]
  86. ////
  87. = CSS styles
  88. OliveTin allows you to write any CSS style rules directly on a single action.
  89. This is both pretty powerful if you want an action to have a particular style,
  90. but it does require understanding that you are writing your code - and can
  91. break things! Be careful!
  92. A tutorial on how to use CSS can easily be found online, but here are some
  93. examples;
  94. == Example: Bold & Purple action
  95. ----
  96. - actions:
  97. - title: My special action
  98. css:
  99. background-color: purple
  100. font-weight: bold
  101. shell: echo "I like purple"
  102. ----
  103. ////