Using dark mode
Style support the standard @media (prefers-color-scheme:dark)
directive.
As you can see in the default CSS used by PlantUML.
The previous example with OrangeRed
with light mode and DarkGoldenRod
with dark mode.
Running in dark mode
-
If you are using link::command-line[the command line], you can add
-darkmode
flag to your command line to generate diagrams with dark-mode. -
If you are using link::api[the public API], you have to specify the use of dark mode in
FileFormatOption
. For example:
String source = "@startuml\n"; source += "Bob -> Alice : hello\n"; source += "@enduml\n"; SourceStringReader reader = new SourceStringReader(source); final ByteArrayOutputStream os = new ByteArrayOutputStream(); // Write the first image to "os" String desc = reader.generateImage(os, new FileFormatOption(FileFormat.PNG).withColorMapper(ColorMapper.DARK_MODE)); os.close();