feat: Update color palette logic to use CSS custom properties for theme consistency

This commit is contained in:
Matt Batchelder
2026-04-05 21:41:08 -04:00
parent 5c1f7f43ce
commit cebad6e143
2 changed files with 16 additions and 6 deletions

View File

@@ -13,11 +13,17 @@
var LINE_W = 340; // line graph width in SVG units
var PIE_R = 55; // pie chart radius
var DARK = { text: '#E0E0E0', muted: '#9E9E9E', border: '#333', center: '#1A1A1A' };
var LIGHT = { text: '#333333', muted: '#666666', border: '#E0E0E0', center: '#fff' };
function isDark() { return document.documentElement.getAttribute('data-theme') === 'dark'; }
function pal() { return isDark() ? DARK : LIGHT; }
/* Resolve colors from CSS custom properties so the animator always reflects
* the active theme (including any admin-customised palette values). */
function pal() {
var s = getComputedStyle(document.documentElement);
return {
text: s.getPropertyValue('--color-text').trim(),
muted: s.getPropertyValue('--color-text-muted').trim(),
border: s.getPropertyValue('--color-border').trim(),
center: s.getPropertyValue('--color-bg').trim()
};
}
function wave(t, off) {
return Math.max(0, Math.min(1,