marudor / bahn.expert

https://bahn.expert
MIT License
435 stars 38 forks source link

Use theme as per prefers-color-scheme #876

Open leoheitmannruiz opened 1 month ago

leoheitmannruiz commented 1 month ago

Describe the bug bahn.expert doesn't seem to use the theme sent by my browser.

To Reproduce Steps to reproduce the behavior:

  1. Go to bahn.expert
  2. Make your browser "request" light theme
  3. See bahn.expert using dark theme

Expected behavior I expect bahn.expert to use it's light theme when my browser sends a light theme "request" and dark theme, when my browser sends dark theme.

Smartphone (please complete the following information):

Additional context Not sure if this is intended behaviour. I assume it's not, as I see some prefers-color-scheme logic and it seems to have worked in the past #17.

I really enjoy using bahn.expert!! Thanks a lot <3 Also, I appreciate the SVG favicon with prefers-color-scheme support!

marudor commented 1 month ago

Oh. Yeah I guess I broke it when the theme deciding logic changed. Most likely won't be able to do any time soon though - not enough time.

The logic always sets the first theme it decided in your local storage. So if you changed the system setting from dark to light after visiting bahn.expert it will (most likely) not change. Thats also something I should probably change to keep the automatic logic unless you click on a explicit theme.