MCPcopy
hub / github.com/koala73/worldmonitor / getCSSColor

Function getCSSColor

src/utils/theme-colors.ts:10–22  ·  view source on GitHub ↗
(varName: string)

Source from the content-addressed store, hash-verified

8 * @returns The computed color value string
9 */
10export function getCSSColor(varName: string): string {
11 const currentTheme = document.documentElement.dataset.theme || 'dark';
12 if (currentTheme !== cacheTheme) {
13 colorCache.clear();
14 cacheTheme = currentTheme;
15 }
16 const cached = colorCache.get(varName);
17 if (cached) return cached;
18 const value = getComputedStyle(document.documentElement)
19 .getPropertyValue(varName).trim();
20 colorCache.set(varName, value);
21 return value;
22}
23
24/**
25 * Invalidate the color cache. Call when theme changes to ensure

Callers 15

levelColorMethod · 0.90
componentBarsMethod · 0.90
updateNewsMethod · 0.90
renderClusterHtmlMethod · 0.90
constructorMethod · 0.90
renderGaugeMethod · 0.90
renderSparklineMethod · 0.90
renderRegionsMethod · 0.90
renderCapacityChartMethod · 0.90
createCardMethod · 0.90
renderTimelineItemMethod · 0.90
renderRegulationCardMethod · 0.90

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected