Skip to content
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

Examples in GH dark mode #23

Open
martinthomson opened this issue Jul 25, 2023 · 3 comments
Open

Examples in GH dark mode #23

martinthomson opened this issue Jul 25, 2023 · 3 comments

Comments

@martinthomson
Copy link

These examples are black lines on a black background, which doesn't work so well.

@dmullis
Copy link
Contributor

dmullis commented Jul 31, 2023

This bug is agent-specific: Line color as shown for README.md is correct on Firefox, but wrong on Safari, as described in this bug. MDN tells us that the behavior "Respects color-scheme inherited from parent" of property prefers-color-scheme is non-standard, specific to Firefox only.

Line color on all the SVG examples accessible from sub-directory examples appears correct as served by Github, on both Firefox and Safari, with the browser preference set to either of dark or light modes.

Examining with Firefox DevTools-Inspector README.md as served by Github in dark mode shows CSS property color-scheme being set in the GH-specific file color-modes.scss. Toggling the property off interactively via Inspector causes SVG line color to go black as described in the bug report.

Two strategies for correction are possible:

  1. Further analyze the HTML environment specific to Github's presentation of the top-level README.md and craft a fix to be applied in goat's generated README.md or SVG files.
  2. Remove all SVG rendering from the top-level README.md and refer the visitor to examples instead.

@martinthomson
Copy link
Author

@dmullis, thanks for the analysis. I had previously concluded that it was not possible to fix how SVG was rendered when included with <img> tags from markdown. But the fix here does seem to work at least as far as some browsers go (Chromium also respects the necessary SVG media query).

Another approach to consider - which might be the same as option 1 - is to render a backdrop on each of the sample images; the cost of that being that you'd probably want new code for that. That could be white or near-white by default and use the same media query to invert for dark mode.

@dmullis
Copy link
Contributor

dmullis commented Aug 1, 2023

render a backdrop on each of the sample images

I spent a few hours experimenting with adding such a feature to the CLI of goat, but propagating the additional color information through the source code, and then the HTML/CSS at runtime became intolerably unwieldy.

dmullis pushed a commit to dmullis/goat that referenced this issue Aug 3, 2023
dmullis pushed a commit to dmullis/goat that referenced this issue Aug 3, 2023
dmullis pushed a commit to dmullis/goat that referenced this issue Aug 3, 2023
blampe pushed a commit that referenced this issue Apr 19, 2024
Document workaround for #23: Safari-specific limit to CSS property inheritance
    
Fix #20 and #21.

Add a Github-specific status badge.

---------

Co-authored-by: dmullis <dmullis>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants