Skip to main content
100%

Using CSS Variables in JS

✓ Published0🌍 Public
CCurran Kelleher
Last edited Jul 2, 2025
Created on Jul 2, 2025

This interactive scatter plot demonstrates dynamic theme switching through CSS variables. A menu lets users toggle between three color palettes—ggplot, Tableau 10, and BBC Primary—with selections persisted via localStorage. D3’s `select`, `join`, and event handlers render six circles positioned from static data, while `getComputedStyle` reads the active theme’s CSS custom properties to update fill colors on each theme change.

AI-generated description
MIT Licensed

Similar vizzes