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

Suggested CSS to support option configuration when using "dark mode" #2405

Closed
irvinm opened this issue Nov 1, 2019 · 9 comments
Closed

Suggested CSS to support option configuration when using "dark mode" #2405

irvinm opened this issue Nov 1, 2019 · 9 comments
Labels
Firefox-issue bug of Firefox itself

Comments

@irvinm
Copy link
Contributor

irvinm commented Nov 1, 2019

There is a CSS tag to detect when using dark or light mode (https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme) which would allow better support of dark mode when configuring TST.

Currently when dark mode is enabled (Windows 10 -> Settings -> Personalization -> Colors -> Custom -> Choose your default app mode -> Dark), the TST configuration screen looks like:

Snag_e82027f

When I add the CSS below to the TST options.html page dynamically in the broswer, I can get a better match with dark mode and it properly reverts back to the white version when in "light mode".

@media (prefers-color-scheme: dark) {
  html {
    --input-background: #474749;
    --link-color: var(--blue40);
    --link-color-hover: var(--blue50);
    --link-color-active: var(--blue60);

    color: white;
    background: black;
  }
  
  input,
  textarea,
  select {
    color: white;
    background: gray;
    border: solid 1px var(--grey50) !important;
  }
}

Snag_e86b5ed

I am not even sure if I got all of the CSS tags that need to be covered (or which colors your would want to use) but seems like this can be done fairly easy using the "prefers-color-scheme" CSS media feature.

If you don't want to do it, please feel free to close this item. :)

@piroor piroor added the Firefox-issue bug of Firefox itself label Nov 1, 2019
@piroor
Copy link
Owner

piroor commented Nov 1, 2019

I think this should be fixed by Firefox itself, like https://bugzilla.mozilla.org/show_bug.cgi?id=1544212

@piroor
Copy link
Owner

piroor commented Nov 1, 2019

I've filed: 1593355 - Options page in about:addons is still shown with bright color on Dark mode
https://bugzilla.mozilla.org/show_bug.cgi?id=1593355

@irvinm
Copy link
Contributor Author

irvinm commented Nov 2, 2019

Thanks @piroor! Let's see how this all plays out.

@jakobbbb
Copy link

jakobbbb commented Nov 5, 2019

Hey,

unfortunately, since TST 3.2.3, TST has stopped respecting the Apply Browser Theme option for me.

I use a dark GTK theme (I'm on Linux) and have set Firefox's theme to default so that it uses that GTK theme. I also set widget.content.allow-gtk-dark-theme to true, as suggested in #2314 (comment).

I got the Plain theme to work again by disabling the newly added CSS with the prefers-color-scheme selector:

@media (prefers-color-scheme: dark) {

I'm sure there is a way to prevent this bit of CSS overriding the theme if Apply Browser Theme is active?

@Nitrooo
Copy link

Nitrooo commented Nov 5, 2019

unfortunately, since TST 3.2.3, TST has stopped respecting the Apply Browser Theme option for me.

Same problem here on 3.2.3.

@piroor
Copy link
Owner

piroor commented Nov 6, 2019

Sorry for the regression. With the commit 0b8dc5e TST now respects the system color even if it is detected as the "Dark" color scheme. Screenshots:

TST 3.2.3 + HighContrastInverse: tabs are shown with the built-in Dark color sheme
image

TST development build + HighContrastInverse: tabs are shown with colors specified by the HighContrastInverse theme
image

@piroor
Copy link
Owner

piroor commented Nov 6, 2019

TST 3.2.3+ HighContrastInverse + "OldWood" Firefox theme: tabs are shown with the built-in Dark color sheme
image

TST development build + HighContrastInverse + "OldWood" Firefox theme: tabs are shown with colors specified by the HighContrastInverse theme, respecting "OldWood" Firefox theme
image

@jakobbbb
Copy link

jakobbbb commented Nov 6, 2019

Thank you very much, the styling works as expected in the latest development version:
tstfixed
3.2.3+Plain on the left, Dev Version+Plain on the right

@irvinm
Copy link
Contributor Author

irvinm commented Nov 8, 2019

@piroor I am closing this issue as everything looks good now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Firefox-issue bug of Firefox itself
Projects
None yet
Development

No branches or pull requests

4 participants