MCPcopy Create free account
hub / github.com/pollinations/pollinations / syncThemeColor

Function syncThemeColor

packages/ui/src/primitives/ColorModeToggle.tsx:57–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

55// the computed --polli-color-app-bg token — never a hardcoded value. Runs on
56// mount / mode change, after styles load, so the token resolves per mode.
57function syncThemeColor(): void {
58 if (typeof document === "undefined") return;
59 const appBg = getComputedStyle(document.documentElement)
60 .getPropertyValue("--polli-color-app-bg")
61 .trim();
62 if (!appBg) return;
63 let meta = document.querySelector('meta[name="theme-color"]');
64 if (!meta) {
65 meta = document.createElement("meta");
66 meta.setAttribute("name", "theme-color");
67 document.head.appendChild(meta);
68 }
69 meta.setAttribute("content", appBg);
70}
71
72function emit(): void {
73 for (const listener of listeners) listener();

Callers 1

applyFunction · 0.85

Calls 1

setAttributeMethod · 0.65

Tested by

no test coverage detected