@kcne 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
+}

I appreciate your feedback @hlfan. From my understanding, the primary issue was 
that when the “Auto” option is enabled, changes in the system’s 
prefers-color-scheme weren’t being reflected. With the new matchMedia logic, 
however, we’re directly listening for those changes, which triggers a re-draw 
of the heatmap whenever the user’s color scheme switches.

If you’re still seeing a scenario where the theme isn’t updating correctly, 
please let me know so I can investigate further. Otherwise, the current 
solution should correctly handle automatic theme changes.

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

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

Reply via email to