abtmtr-v4/views/scripts/interface.js

23 lines
777 B
JavaScript
Raw Normal View History

function propagateStyles(rootStyles, parent) {
if (parent == null && window.frameElement == null) return;
const wfParent = parent ?? window.frameElement.parentElement;
2023-11-23 08:53:28 +00:00
wfParent.style.setProperty(
"--background-color",
rootStyles.getPropertyValue("--background-color")
);
wfParent.style.setProperty("--color", rootStyles.getPropertyValue("--color"));
wfParent.style.setProperty(
"--accent-color",
rootStyles.getPropertyValue("--accent-color")
);
wfParent.style.setProperty(
"--accent-color-fg",
rootStyles.getPropertyValue("--accent-color-fg")
);
wfParent.style.setProperty("--border-style", "0.0625em solid var(--color)");
}
window.addEventListener("load", () => {
propagateStyles(getComputedStyle(document.documentElement));
});