You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider the following case:
I have a page, that manages dark mode on it's own: supports auto via media-query, user can override to dark or light.
The problem is not all browsers on all platforms support system's dark mode detection. I believe quite common combo: Chrome on Linux Mint with Cinnamon (afair it's even worse on xfce even with Firefox).
So I added <meta name="darkreader-lock">, but then comes the user with poor browser<->OS communication, who is vampire enough to manually toggle dark reader twice a day like myself.
As a workaround I see that I can dynamically add darkreader-lock, only when I already activated page's dark theme, so DR can kick in and override. After that I can observe mutations and when I see "meta[name=darkreader]", switch to my own dark and disable DR with lock. As to me it seems a bit over-complicated bicycle...
Is there a better way already?
Is there any APIs exposed by DR? I believe some other use cases could beneift, e.g. #11450
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Somewhat related to Disable Dark Reader on my website
Consider the following case:
I have a page, that manages dark mode on it's own: supports auto via media-query, user can override to dark or light.
The problem is not all browsers on all platforms support system's dark mode detection. I believe quite common combo: Chrome on Linux Mint with Cinnamon (afair it's even worse on xfce even with Firefox).
So I added
<meta name="darkreader-lock">, but then comes the user with poor browser<->OS communication, who is vampire enough to manually toggle dark reader twice a day like myself.As a workaround I see that I can dynamically add darkreader-lock, only when I already activated page's dark theme, so DR can kick in and override. After that I can observe mutations and when I see
"meta[name=darkreader]", switch to my own dark and disable DR with lock. As to me it seems a bit over-complicated bicycle...Is there a better way already?
Is there any APIs exposed by DR? I believe some other use cases could beneift, e.g. #11450
Beta Was this translation helpful? Give feedback.
All reactions