browserpass-extension icon indicating copy to clipboard operation
browserpass-extension copied to clipboard

automatic dark theme setting

Open 532910 opened this issue 5 years ago • 9 comments

Dark theme setting must be taken from the browser settings, rather than bother users with superfluous checkboxes (:

It's same as https://github.com/Drive4ik/simple-tab-groups/issues/502 and @Drive4ik says is really hard to implement. Leave it open untill mozilla will provide a handy way.

532910 avatar Feb 12 '20 14:02 532910

Are you referring to the color scheme of the dark theme (i.e. which shade of dark gray to use as background), or are you referring to the automatic detection of whether to use light or dark theme?

The former one is not only hard to implement, but also not something I would like to do regardless, we spent a lot of time polishing the design and finding these particular colors to get a very neat UI, and I wouldn't want to give this away, sorry :)

The latter one is actually rather simple to implement by respecting not browser settings, but OS settings:

https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme https://css-tricks.com/dark-modes-with-css/

But will we accept removing the ability to configure theme in the extension options, in favor of this automatic detection?

I personally would be okay with automatic detection, but I fear others might not like this. @erayd what do you think?

And if we keep the theme configuration in the extension options, then I see little value in implementing an automatic theme detection - those who don't like the default dark theme will be totally fine going in the option and changing the theme, this will take a long time to pay off in developer time...

max-baz avatar Feb 12 '20 15:02 max-baz

Are you referring to the color scheme of the dark theme (i.e. which shade of dark gray to use as background) we spent a lot of time polishing the design and finding these particular colors

Noway, current dark theme looks really nice. Thank you (:

I'm about automatic detection of whether to use light or dark theme.

But will we accept removing the ability to configure theme in the extension options, in favor of this automatic detection?

It's up to you, I see nothing wrong with tri-state selector system-dark-white with default to system.

532910 avatar Feb 12 '20 15:02 532910

I've found addon that respects main theme: Tampermonkey:

image

image

532910 avatar Feb 12 '20 15:02 532910

I personally would be okay with automatic detection, but I fear others might not like this. @erayd what do you think?

My preference would be a tristate - light, dark, or auto. I personally use a light browser theme, but mostly have the browserpass theme set to dark. We already have a dropdown for it, so I don't see adding an 'auto' option as cluttering the settings at all. Having 'auto' as the default makes sense too I think; users that want something else will know what they need, and everybody else can simply ignore it.

erayd avatar Feb 13 '20 01:02 erayd

I like three state too, I only fear this will be not trivial to implement for a very little value gain. But maybe I'm wrong, if someone wants to give it a go, please open a PR 🙂

max-baz avatar Feb 13 '20 07:02 max-baz

can it be done with @media -> prefers-color-scheme css selector?

532910 avatar Feb 13 '20 07:02 532910

yes but since the logic has to be done in css, and not in js, I imagine it would become something like

prefers-dark {
  all dark theme styles 
}

prefers-dark selected-light {
  all light theme styles 
}

...

max-baz avatar Feb 13 '20 08:02 max-baz

What's the actual mechanism by which we can detect whether the browser is using a dark theme? Seems to me that this should be trivial to implement.

Why can't we use JavaScript as part of this? We use it everywhere else.

erayd avatar Feb 13 '20 08:02 erayd

media query is the only known option to me; if we want to get the value into javascript, I think the only available option is to paint some hidden block differently using this media query, and then use getComputedStyle to see which style was applied.

max-baz avatar Feb 13 '20 08:02 max-baz

Shipped in 3.8.0 :rocket:

max-baz avatar Oct 29 '23 21:10 max-baz

https://github.com/browserpass/browserpass-extension/issues/202 still actual though

532910 avatar Oct 29 '23 23:10 532910