comprehensive-rust icon indicating copy to clipboard operation
comprehensive-rust copied to clipboard

Dark Mode SVG Text Fix

Open nofurtherinformation opened this issue 2 years ago • 2 comments

Currently, SVG text in many of the diagrams appears as black on dark blue in dark mode. The SVG text elements currently receive the default color, black:

Light mode: image

Dark mode: image

This PR suggests a one-liner CSS fix to apply the foreground css variable (var(--fg)) to the svg text element to make svg text legible and accessible. This is bundled into the output using the additional-css property in mdbook's config book.toml.

This is probably something that could be fixed upstream in mdbook/mdbook-svgbob sometime, but this patch would fix it for current usability.

nofurtherinformation avatar Dec 23 '22 16:12 nofurtherinformation

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Dec 23 '22 16:12 google-cla[bot]

Hi @nofurtherinformation, thanks a lot for looking into this!

This PR suggests a one-liner CSS fix to apply the foreground css variable (var(--fg)) to the svg text element to make svg text legible and accessible.

Super nice! I definitely want the different themes to be legible so this is important to fix. Could you update the PR description with an image showing how it looks after your fix? (I can check it out myself, but it'll be useful for others to see what the fix does).

I agree that we should file an issue upstream (probably mdbook-svgbob) about this. I'll be happy to do that after we merge this.

mgeisler avatar Dec 23 '22 22:12 mgeisler

Apologies for the slow reply here @mgeisler (I was a bit offline for the holidays) and thanks for merging this in! For posterity, here is a screenshot of the new styling. Screen Shot 2023-01-03 at 10 07 02 AM

nofurtherinformation avatar Jan 03 '23 16:01 nofurtherinformation

No worries at all, I was also out myself :smile: Thanks for the elegant fix, it would have taken me a while to figure this out myself!

mgeisler avatar Jan 05 '23 12:01 mgeisler

I reported it upstream now, I hope the fix can be included there somehow: https://github.com/boozook/mdbook-svgbob/issues/22.

mgeisler avatar Jan 05 '23 18:01 mgeisler