boozook / mdbook-svgbob

SvgBob mdbook preprocessor which swaps code-blocks with neat SVG.
Mozilla Public License 2.0
76 stars 8 forks source link

Diagrams don't use theme colors #22

Open mgeisler opened 1 year ago

mgeisler commented 1 year ago

I got a PR from @nofurtherinformation to fix the diagram colors when a dark theme is used in mdbook: https://github.com/google/comprehensive-rust/pull/48.

The problem is that the diagrams use black as the text color — even when the background color is very dark.

The fix is simply to include a style sheet with

svg text {
  fill: var(--fg);
}

I'm not sure where the right place is to add such a CSS rule since mdbook-svgbob is a preprocessor. Perhaps it could be a style="fill: var(--fg)" attribute instead somewhere on the generated SVG?

hmn53 commented 9 months ago

Hey @mgeisler, I have verified that adding style="fill: var(--fg)" in svgbob.rs does the job. Can we go ahead with that?

mgeisler commented 9 months ago

Sounds great, thanks @hmn53 for digging into this!