From a11853cad67890afcc8a6570c290b785d2edab9a Mon Sep 17 00:00:00 2001 From: auctumnus Date: Sat, 20 Aug 2022 18:35:47 -0500 Subject: [PATCH 1/3] feat: change prefers-color-scheme --- src/background/extension.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/background/extension.ts b/src/background/extension.ts index ba6093a..4fc8429 100644 --- a/src/background/extension.ts +++ b/src/background/extension.ts @@ -252,7 +252,7 @@ export default class Extension { const template = this.state.getTemplate(); const colorscheme = Generators.colorscheme(mode, pywalColors, customColors, template); - this.setBrowserTheme(colorscheme.browser); + this.setBrowserTheme(colorscheme.browser, mode); this.updateExtensionPagesTheme(colorscheme.extension); if (this.state.getDDGThemeEnabled()) { @@ -300,8 +300,21 @@ export default class Extension { } } - private setBrowserTheme(browserTheme: IBrowserTheme) { - browser.theme.update({ colors: browserTheme }); + private setBrowserTheme(browserTheme: IBrowserTheme, mode?: ThemeModes.Dark | ThemeModes.Light) { + const modeString = (mode === ThemeModes.Dark) ? 'dark' : 'light'; + + console.log(mode); + console.log(modeString); + + browser.theme.update({ + colors: browserTheme, + properties: { + // @ts-ignore + color_scheme: modeString, + // @ts-ignore + content_color_scheme: modeString, + }, + }); } private setDDGEnabled({ option, enabled }: IOptionSetData) { From 993bd4e9847933fc692a7ea436cc5e9cbc019d81 Mon Sep 17 00:00:00 2001 From: auctumnus Date: Sat, 20 Aug 2022 18:38:25 -0500 Subject: [PATCH 2/3] feat: change prefers-color-scheme (#93) --- src/background/extension.ts | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/background/extension.ts b/src/background/extension.ts index ba6093a..4fc8429 100644 --- a/src/background/extension.ts +++ b/src/background/extension.ts @@ -252,7 +252,7 @@ export default class Extension { const template = this.state.getTemplate(); const colorscheme = Generators.colorscheme(mode, pywalColors, customColors, template); - this.setBrowserTheme(colorscheme.browser); + this.setBrowserTheme(colorscheme.browser, mode); this.updateExtensionPagesTheme(colorscheme.extension); if (this.state.getDDGThemeEnabled()) { @@ -300,8 +300,21 @@ export default class Extension { } } - private setBrowserTheme(browserTheme: IBrowserTheme) { - browser.theme.update({ colors: browserTheme }); + private setBrowserTheme(browserTheme: IBrowserTheme, mode?: ThemeModes.Dark | ThemeModes.Light) { + const modeString = (mode === ThemeModes.Dark) ? 'dark' : 'light'; + + console.log(mode); + console.log(modeString); + + browser.theme.update({ + colors: browserTheme, + properties: { + // @ts-ignore + color_scheme: modeString, + // @ts-ignore + content_color_scheme: modeString, + }, + }); } private setDDGEnabled({ option, enabled }: IOptionSetData) { From f1f677671ca1c51888e1500423de039d78a7adf1 Mon Sep 17 00:00:00 2001 From: auctumnus Date: Sat, 20 Aug 2022 18:41:36 -0500 Subject: [PATCH 3/3] style: remove extraneous console.logs --- src/background/extension.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/background/extension.ts b/src/background/extension.ts index 4fc8429..43c8d3c 100644 --- a/src/background/extension.ts +++ b/src/background/extension.ts @@ -303,9 +303,6 @@ export default class Extension { private setBrowserTheme(browserTheme: IBrowserTheme, mode?: ThemeModes.Dark | ThemeModes.Light) { const modeString = (mode === ThemeModes.Dark) ? 'dark' : 'light'; - console.log(mode); - console.log(modeString); - browser.theme.update({ colors: browserTheme, properties: {