@HolgerJeromin commented on this pull request.


> +function getThemeFromColorScheme(colorScheme) {
+  if (colorScheme === "auto") {
+    return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" 
: "light";
+  }
+  return colorScheme; // Return "light" or "dark" directly if specified
+}

`getThemeFromColorScheme` returns the correct theme. Yes. 
But it is only called on load (`DOMContentLoaded`) and not when the user 
changes operating system theme.

Missing something like:
`window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", 
xy);`


-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5402#discussion_r1914788494
You are receiving this because you are subscribed to this thread.

Message ID: 
<openstreetmap/openstreetmap-website/pull/5402/review/2549662...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev

Reply via email to