logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/

howto_theming_your_instance.md (4086B)


  1. # Theming your instance
  2. To add a custom theme to your instance, you'll first need to get a custom theme, upload it to the server, make it available to the instance and eventually you can set it as default.
  3. ## Getting a custom theme
  4. ### Create your own theme
  5. * You can create your own theme using the Pleroma FE by going to settings (gear on the top right) and choose the Theme tab. Here you have the options to create a personal theme.
  6. * To download your theme, you can do Save preset
  7. * If you want to upload a theme to customise it further, you can upload it using Load preset
  8. This will only save the theme for you personally. To make it available to the whole instance, you'll need to upload it to the server.
  9. ### Get an existing theme
  10. * You can download a theme from another instance by going to that instance, go to settings and make sure you have the theme selected that you want. Then you can do Save preset to download it.
  11. * You can also find and download custom themes at <https://plthemes.vulpes.one/>
  12. ## Adding the custom theme to the instance
  13. ### Upload the theme to the server
  14. Themes can be found in the [static directory](static_dir.md). Create `STATIC-DIR/static/themes/` if needed and copy your theme there. Next you need to add an entry for your theme to `STATIC-DIR/static/styles.json`. If you use a from source installation, you'll first need to copy the file from `priv/static/static/styles.json`.
  15. Example of `styles.json` where we add our own `my-awesome-theme.json`
  16. ```json
  17. {
  18. "pleroma-dark": [ "Pleroma Dark", "#121a24", "#182230", "#b9b9ba", "#d8a070", "#d31014", "#0fa00f", "#0095ff", "#ffa500" ],
  19. "pleroma-light": [ "Pleroma Light", "#f2f4f6", "#dbe0e8", "#304055", "#f86f0f", "#d31014", "#0fa00f", "#0095ff", "#ffa500" ],
  20. "classic-dark": [ "Classic Dark", "#161c20", "#282e32", "#b9b9b9", "#baaa9c", "#d31014", "#0fa00f", "#0095ff", "#ffa500" ],
  21. "bird": [ "Bird", "#f8fafd", "#e6ecf0", "#14171a", "#0084b8", "#e0245e", "#17bf63", "#1b95e0", "#fab81e"],
  22. "ir-black": [ "Ir Black", "#000000", "#242422", "#b5b3aa", "#ff6c60", "#FF6C60", "#A8FF60", "#96CBFE", "#FFFFB6" ],
  23. "monokai": [ "Monokai", "#272822", "#383830", "#f8f8f2", "#f92672", "#F92672", "#a6e22e", "#66d9ef", "#f4bf75" ],
  24. "redmond-xx": "/static/themes/redmond-xx.json",
  25. "redmond-xx-se": "/static/themes/redmond-xx-se.json",
  26. "redmond-xxi": "/static/themes/redmond-xxi.json",
  27. "breezy-dark": "/static/themes/breezy-dark.json",
  28. "breezy-light": "/static/themes/breezy-light.json",
  29. "mammal": "/static/themes/mammal.json",
  30. "my-awesome-theme": "/static/themes/my-awesome-theme.json"
  31. }
  32. ```
  33. Now you'll already be able to select the theme in Pleroma FE from the drop-down. You don't need to restart Pleroma because we only changed static served files. You may need to refresh the page in your browser. You'll notice however that the theme doesn't have a name, it's just an empty entry in the drop-down.
  34. ### Give the theme a name
  35. When you open one of the themes that ship with Pleroma, you'll notice that the json has a `"name"` key. Add a key-value pair to your theme where the key name is `"name"` and the value the name you want to give your theme. After this you can refresh te page in your browser and the name should be visible in the drop-down.
  36. Example of `my-awesome-theme.json` where we add the name "My Awesome Theme"
  37. ```json
  38. {
  39. "_pleroma_theme_version": 2,
  40. "name": "My Awesome Theme",
  41. "theme": {}
  42. }
  43. ```
  44. ### Set as default theme
  45. Now we can set the new theme as default in the [Pleroma FE configuration](../../../frontend/CONFIGURATION).
  46. Example of adding the new theme in the back-end config files
  47. ```elixir
  48. config :pleroma, :frontend_configurations,
  49. pleroma_fe: %{
  50. theme: "my-awesome-theme"
  51. }
  52. ```
  53. If you added it in the back-end configuration file, you'll need to restart your instance for the changes to take effect. If you don't see the changes, it's probably because the browser has cached the previous theme. In that case you'll want to clear browser caches. Alternatively you can use a private/incognito window just to see the changes.