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

Emin Kocan notifications at github.com
Tue Jan 14 12:56:07 UTC 2025


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


More information about the rails-dev mailing list