BeWelcome / rox

:earth_africa: BeWelcome lets you share a place to stay, connect with travellers, meet up and find accommodation on your journey. It is and will always be a free, open source, non for profit, democratic community.
https://www.bewelcome.org
GNU General Public License v2.0
188 stars 54 forks source link

Automatic dark color scheme stylesheet theme using the `prefers-color-scheme` browser media query #321

Open nekohayo opened 1 year ago

nekohayo commented 1 year ago

My operating system does the switch for me everyday at the correct times, and my web browser follows suit, telling webpages' CSS mediaqueries that dark is now "preferred" or not.

BW's web interface could automatically offer a dark stylesheet at nighttime using this trick, i.e. "automatic" light and dark themes "based on browser/OS setting", as the default behavior (rather than needing users to turn this on as a setting)? You can detect this condition using this simple piece of CSS, such as:

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

This might be interesting not only for desktop computers, but also for people using the web interface on mobile devices; that way if they're reading messages/directions at night on the street or in a dimly lit location, they won't get blinded by the white screen. It also tends to consume less power on AMOLED displays.

nekohayo commented 11 months ago

I think the color palette (bright orange) will have to have a dark mode variant / adaptation for dark mode. See https://css-tricks.com/a-complete-guide-to-dark-mode-on-the-web/#aa-dark-mode-color-palettes (and the many other guidelines there)