fix light mode in dark system, properly
This commit is contained in:
parent
77562ecd8d
commit
bef70f6db3
|
@ -12,6 +12,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
API.colorScheme.shouldIncludeStyle('darkUI').then(val => {
|
API.colorScheme.shouldIncludeStyle('darkUI').then(val => {
|
||||||
|
const ON = 'screen';
|
||||||
|
const OFF = 'not all';
|
||||||
|
const map = {[ON]: true, [OFF]: false};
|
||||||
let isDark = val;
|
let isDark = val;
|
||||||
toggleDarkStyles();
|
toggleDarkStyles();
|
||||||
msg.onExtension(e => {
|
msg.onExtension(e => {
|
||||||
|
@ -24,8 +27,8 @@ API.colorScheme.shouldIncludeStyle('darkUI').then(val => {
|
||||||
$.root.dataset.uiTheme = isDark ? 'dark' : 'light';
|
$.root.dataset.uiTheme = isDark ? 'dark' : 'light';
|
||||||
for (const sheet of document.styleSheets) {
|
for (const sheet of document.styleSheets) {
|
||||||
for (const {media: m} of sheet.cssRules) {
|
for (const {media: m} of sheet.cssRules) {
|
||||||
if (m && m[1] === 'dark' && /screen/.test(m[0]) !== isDark) {
|
if (m && m[1] === 'dark' && map[m[0]] !== isDark) {
|
||||||
m.mediaText = isDark ? 'screen,dark' : 'not all,dark';
|
m.mediaText = `${isDark ? ON : OFF},dark`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user