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

Support setting light/dark mode on a per site/URL basis. #55

Closed
vamega opened this issue May 30, 2023 · 3 comments
Closed

Support setting light/dark mode on a per site/URL basis. #55

vamega opened this issue May 30, 2023 · 3 comments
Labels
duplicate This issue or pull request already exists enhancement New feature or request

Comments

@vamega
Copy link

vamega commented May 30, 2023

Background

My system preference is set to use dark mode.
I browse some websites where their dark mode theme makes the content barely legible.
I use the extension to switch those website to use light mode (the websites in question use media queries, so forcing light mode works).

However this addon currently switches this preference across all sites in my browser.

Proposed solution

Allow associating this preference on a per-site basis.

Alternatives

Continue to toggle this on a per site basis.

Additional context

I'm unsure if the overrideContentColorScheme API allows changes like this to be isolated to a website. A quick scan of the code made me aware that this was the API that was being used to change the result of the media query prefers-color-scheme.

I was originally hoping to do this via Stylus, since it has the ability to set styles on a per site/per url basis, but couldn't find a way to change the result of the media query. This addon lets me change the result of the media-query, but applies that globally.

@vamega vamega added the enhancement New feature or request label May 30, 2023
@rugk
Copy link
Owner

rugk commented May 31, 2023

Thanks for your elaborate request. Yeah as you correctly noticed your feature request is hard to implement unfortunately. Actually this is a duplicate of #12, there it is also explained that the API is global, and AFAIK this has not changed until now, so there is nothing I can do.

What you could do or also work upon is using the old v1.3 version, which does what you basically wanted to do with Stylus. However, overriding that media query is way harder than you may think (feel free to look through the code and PRs by contributors) and ends up being quite unreliable, so for now I prefer to stick and use the Firefox API.
More information about that history in the latest release notes for v2.0.

@rugk
Copy link
Owner

rugk commented May 31, 2023

Duplicate of #12

@rugk rugk marked this as a duplicate of #12 May 31, 2023
@rugk rugk closed this as not planned Won't fix, can't repro, duplicate, stale May 31, 2023
@rugk rugk added the duplicate This issue or pull request already exists label May 31, 2023
@vamega
Copy link
Author

vamega commented May 31, 2023

Thanks so much for such a detailed response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants