-
-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Setting background color with a diagram option #1281
Comments
I definitely want to "support" dark mode but I think it should be supported upstream. What Kroki can do is provide a generic option to activate dark mode (i.e., automatically infer which options need to be configured). For instance, on svgbob it should configure |
Thanks for your response. Your proposal of the dark mode support is a great idea. But what I was suggesting is a bit different. Please let me clarify. My proposal mostly concerns readability. Right now, there is no readability issue with PalantUML or Svgbob. They provide dark elements on a white background. This white background may not match with a dark-themed website or app. But that's an aesthetics issue, not a readability issue. On the other hand, BlockDiag or ActDiag returns dark elements on a transparent background, which is not readable on a dark website or app. What I am suggesting is, passing What your proposal solves is the aesthetics issue. But that is not what I am asking for here. Because there are some usecases I can think of, where that issue is not solvable. For example many apps and some websites support dynamic / manual theme switching. So no matter which color you choose for the SVG, chances are it won't look good on some theme. |
I've created the following issues upstream:
Technically, we could postprocess the SVG produced by BlockDiag but it would be somewhat brittle since we won't parse the SVG but replace/insert/update text using a regular expression.
If the SVG is embed in the HTML page then you can update SVG attributes (using JavaScript) when switching from light to dark theme. If the SVG is not embed then you could ask Kroki to generate a "dark" or "light" version depending on the chosen theme. It's somewhat related but it might be a good idea to normalize the default style between diagram libraries. For instance, even if BlockDiag does have a transparent background by default, Kroki could automatically configure a white background to match other diagram libraries. |
Yes, I agree. A common default style would make styling them easier for the users. |
Some libraries allow changing the background color or theme of the diagram, such as Mermaid or PlantUML. But many of them don't. A few of the libraries (Actdiag, Blockdiag etc.) returns a transparent SVG which is often unreadable on a dark background.
Is it possible to set the background color of the SVG using
fill
? If it's possible, and a global diagram option is created for it, we'll be able to set the background without having to rely on upstream.The text was updated successfully, but these errors were encountered: