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

SVG dark mode fix does not work on Webkit browsers #13

Open
banchan86 opened this issue Sep 21, 2024 · 1 comment
Open

SVG dark mode fix does not work on Webkit browsers #13

banchan86 opened this issue Sep 21, 2024 · 1 comment

Comments

@banchan86
Copy link

banchan86 commented Sep 21, 2024

Description

When navigating any of the existing Bonsai websites in dark mode on Webkit browsers, none of the SVGs are responding to the @media (prefers-color-scheme: dark) value. Most clearly visible are the operator text in workflow container images, but also the bonsai logo on the main docs page.

This primarily affects two groups of users

  1. Safari browser
  2. Mobile iOS users due to the fact that all web browsers have to use WebKit on iOS, outside of EU (https://www.theverge.com/2024/1/25/24050478/apple-ios-17-4-browser-engines-eu)

Steps to reproduce

  1. Go to https://bonsai-rx.org/docs/ on either Safari or using any browser on iOS

Cause

This is a known issue with webkit not supporting the @media (prefers-color-scheme: dark) tag in embedded svgs
https://bugs.webkit.org/show_bug.cgi?id=199134
https://www.ctrl.blog/entry/svg-embed-dark-mode.html

Priority

Low priority at this point, it primarily affects a small group of use cases outside the normal operating range when users check Bonsai documentation (Windows/Linux desktop environment).

Solutions

At some point, if we want to tackle this, we can generate a light mode and a dark mode version of each SVG and switch between them as discussed in bonsai-rx/docs#98.

There might also be another way to use another tag for embedded svgs https://webkit.org/blog/8840/dark-mode-support-in-webkit/ but I'm skeptical as the link in that article https://hidde.blog/making-single-color-svg-icons-work-in-dark-mode/ refers to using them for inline SVGs.

https://www.ctrl.blog/entry/svg-embed-dark-mode.html also talks about some other methods (for instance using an object tag) but they come with performance tradeoffs

@banchan86 banchan86 changed the title [Bug] SVG dark mode fix does not work on Safari SVG dark mode fix does not work on Webkit browsers Sep 27, 2024
@banchan86
Copy link
Author

Edited description and closed/merged #12 in as they share the same root cause

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

1 participant