plantuml / plantuml-server

PlantUML Online Server
https://plantuml.com/
GNU General Public License v3.0
1.59k stars 463 forks source link

Do you have plans to support dark mode in the `plantuml-server` such as `/dsvg/` and `/dnpg/`? #314

Open binge6 opened 9 months ago

HeinrichAD commented 9 months ago

Hi. Not as far as I know.

One of the reasons is: what theme should be used as default dark theme?

You can still use !theme <theme-name> to select your theme inside your plantuml code or use e.g. the PLANTUML_CONFIG_FILE environment variable to render all diagrams with a special theme by default.

With the second option you could also build something similar like /dpng using Nginx and two plantuml-server docker container. But maybe not the best idea 😅.

Here is a webpage with examples about different plantuml themes: https://the-lum.github.io/puml-themes-gallery/

The-Lum commented 9 months ago

Hi all,

@HeinrichAD:

One of the reasons is: what theme should be used as default dark theme?

FYI here are some element about dark mode:

Then a new question will be:

If that can help the topic, Regards, Th.

HeinrichAD commented 9 months ago

@The-Lum nice catch. Thank you.

Edit: In this case as a quick fix one could probably use the PLANTUML_PROPERTY_FILE environment variable. But you would force the complete server to always use the dark mode flag.

arnaudroques commented 9 months ago
  • How to propagate the -darkmode flag to the plantuml-server?

Maybe I did not get the point, but to generate an image in "Dark Mode", you have to use the appropriate FileFormatOption. Using .withColorMapper(ColorMapper.DARK_MODE)) method will switch you to Dark Mode.

For example, if you want to generate some PNG image, you will have: new FileFormatOption(FileFormat.PNG).withColorMapper(ColorMapper.DARK_MODE))

So you just have to see if the requested URL starts by /dsvg/ or /dpng/ and if it's the case, call this .withColorMapper(ColorMapper.DARK_MODE)) method.

Concerning the theme, as @The-Lum said, you have to use @media (prefers-color-scheme:dark) in the theme definition, but that's only working for style, not for skinparam.

Hope this help!

VladimirAlexiev commented 1 month ago

@binge6 Do you mind describing exactly what you need? The official server has a button "dark mode" that switches to /duml, and then the links become /dsvg and /dpng.