This commit is contained in:
1152958806@qq.com 2023-07-11 23:51:19 +08:00
parent 9bed18aab9
commit 3c1cf4e44f
1 changed files with 14 additions and 8 deletions

View File

@ -37,10 +37,13 @@ function coverColor() {
value = LightenDarkenColor(colorHex(value), -40) value = LightenDarkenColor(colorHex(value), -40)
} }
document.styleSheets[0].addRule(':root', '--heo-main:' + value + '!important'); const style = document.createElement('style');
document.styleSheets[0].addRule(':root', '--heo-main-op:' + value + '23!important'); document.head.appendChild(style);
document.styleSheets[0].addRule(':root', '--heo-main-op-deep:' + value + 'dd!important'); const styleSheet = style.sheet;
document.styleSheets[0].addRule(':root', '--heo-main-none:' + value + '00!important'); styleSheet.insertRule(`:root{--heo-main: ${value}!important}`, styleSheet.cssRules.length);
styleSheet.insertRule(`:root{--heo-main-op: ${value}23!important}`, styleSheet.cssRules.length);
styleSheet.insertRule(`:root{--heo-main-op-deep: ${value}dd!important}`, styleSheet.cssRules.length);
styleSheet.insertRule(`:root{--heo-main-none: ${value}00!important}`, styleSheet.cssRules.length);
heo.initThemeColor() heo.initThemeColor()
document.getElementById("coverdiv").classList.add("loaded"); document.getElementById("coverdiv").classList.add("loaded");
}) })
@ -50,10 +53,13 @@ function coverColor() {
} else { } else {
// document.styleSheets[0].addRule('#page-header:before','background: none!important'); // document.styleSheets[0].addRule('#page-header:before','background: none!important');
document.styleSheets[0].addRule(':root', '--heo-main: var(--heo-theme)!important'); const style = document.createElement('style');
document.styleSheets[0].addRule(':root', '--heo-main-op: var(--heo-theme-op)!important'); document.head.appendChild(style);
document.styleSheets[0].addRule(':root', '--heo-main-op-deep:var(--heo-theme-op-deep)!important'); const styleSheet = style.sheet;
document.styleSheets[0].addRule(':root', '--heo-main-none: var(--heo-theme-none)!important'); styleSheet.insertRule(`:root{--heo-main: var(--heo-theme)!important}`, styleSheet.cssRules.length);
styleSheet.insertRule(`:root{--heo-main-op: var(--heo-theme-op)!important}`, styleSheet.cssRules.length);
styleSheet.insertRule(`:root{--heo-main-op-deep:var(--heo-theme-op-deep)!important}`, styleSheet.cssRules.length);
styleSheet.insertRule(`:root{--heo-main-none: var(--heo-theme-none)!important}`, styleSheet.cssRules.length);
heo.initThemeColor() heo.initThemeColor()
} }
} }