diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..89d2ea2 Binary files /dev/null and b/.DS_Store differ diff --git a/src/app.css b/src/app.css index b8cefe3..8a6d907 100644 --- a/src/app.css +++ b/src/app.css @@ -13,12 +13,19 @@ body { height: 100vh; } +/* Prevent flash of light theme colour when in dark */ +@media (prefers-color-scheme: dark) { + body { + background-color: #2B2A33; + } +} + body.t-light { - background-color: #fff; + background-color: #F9F9FB; } body.t-dark { - background-color: #323234; + background-color: #2B2A33; } .cntp-iframe { diff --git a/src/app.js b/src/app.js index 8d76de2..e37d87f 100644 --- a/src/app.js +++ b/src/app.js @@ -1,8 +1,19 @@ const log = false; -const showCustomPage = opts => { +const showCustomPage = async opts => { log && console.debug( '[showCustomPage] init', opts ); + if (opts.theme === 'theme') { + let browserNTPBackground; + try { + browserNTPBackground = await browser.theme.getCurrent().then(res => res.colors.ntp_background); + } catch { + browserNTPBackground = "#F9F9FB" + } + + document.body.style.backgroundColor = browserNTPBackground; + } + if ( opts.theme === 'light' ) { document.body.classList.add( 't-light' ); } @@ -49,4 +60,4 @@ const init = _ => { .then( showCustomPage ); }; -init(); +init(); \ No newline at end of file diff --git a/src/manifest.json b/src/manifest.json index ad9ce6b..2fb0bb0 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -14,7 +14,7 @@ "applications": { "gecko": { "id": "custom-new-tab-page@mint.as", - "strict_min_version": "57.0" + "strict_min_version": "58.0" } }, "options_ui": { diff --git a/src/options.html b/src/options.html index 45f999c..fb81d04 100644 --- a/src/options.html +++ b/src/options.html @@ -37,6 +37,7 @@