diff --git a/background/color-scheme.js b/background/color-scheme.js index 1c389623..95553f3c 100644 --- a/background/color-scheme.js +++ b/background/color-scheme.js @@ -34,13 +34,12 @@ const colorScheme = (() => { onChange(listener) { changeListeners.add(listener); }, - /** @param {StyleObj | 'darkUI'} val - the string is used by the built-in dark themer */ - shouldIncludeStyle(val) { - return val === 'darkUI' - ? isDarkNow - : prefs.get(kSTATE) === 'never' || - !SCHEMES.includes(val = val.preferScheme) || - isDarkNow === (val === 'dark'); + isDark: () => isDarkNow, + /** @param {StyleObj} _ */ + shouldIncludeStyle({preferScheme: ps}) { + return prefs.get(kSTATE) === 'never' || + !SCHEMES.includes(ps) || + isDarkNow === (ps === 'dark'); }, updateSystemPreferDark(val) { update('system', val); diff --git a/js/dark-themer.js b/js/dark-themer.js index 04bf1a28..049c899a 100644 --- a/js/dark-themer.js +++ b/js/dark-themer.js @@ -11,11 +11,10 @@ * and not even a problem in the most popular case of using system dark/light mode. */ -API.colorScheme.shouldIncludeStyle('darkUI').then(val => { +API.colorScheme.isDark().then(isDark => { const ON = 'screen'; const OFF = 'not all'; const map = {[ON]: true, [OFF]: false}; - let isDark = val; toggleDarkStyles(); msg.onExtension(e => { if (e.method === 'colorScheme') {