mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 04:42:57 +00:00
Refactor iframe theme accent sync
This commit is contained in:
1 parent
2215e0254d
commit
a697a1de5f
5 files changed
+116
-35
No files matched your search
@@ -133,16 +133,25 @@ const applyAccentOverrides = (root, theme) => {
|
||||
? accentOverrides[theme]
|
||||
: null;
|
||||
|
||||
let hasOverrides = false;
|
||||
|
||||
Object.entries(ACCENT_CSS_VARIABLES).forEach(([token, cssVariable]) => {
|
||||
const overrideValue = themeOverrides ? themeOverrides[token] : null;
|
||||
const normalized = normalizeAccentValue(overrideValue);
|
||||
|
||||
if (normalized) {
|
||||
root.style.setProperty(cssVariable, normalized);
|
||||
hasOverrides = true;
|
||||
} else {
|
||||
root.style.removeProperty(cssVariable);
|
||||
}
|
||||
});
|
||||
|
||||
if (hasOverrides) {
|
||||
root.dataset.themeAccent = "override";
|
||||
} else {
|
||||
root.removeAttribute("data-theme-accent");
|
||||
}
|
||||
};
|
||||
|
||||
const updateThemeColorMeta = (theme) => {
|
||||
@@ -369,4 +378,3 @@ export const initThemeController = () => {
|
||||
applyTheme(initialTheme, { persist: true });
|
||||
refreshThemeControls(document);
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user