[openstreetmap/openstreetmap-website] Add user profile heatmap visualization for contributions (PR #5402)

Holger Jeromin notifications at github.com
Tue Jan 14 13:12:52 UTC 2025


@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/2549662995 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250114/43d03a4b/attachment.htm>


More information about the rails-dev mailing list