abtmtr-v4/views/scripts/interface.js

22 lines
777 B
JavaScript
Executable file

function propagateStyles(rootStyles, parent) {
if (parent == null && window.frameElement == null) return;
const wfParent = parent ?? window.frameElement.parentElement;
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));
});