aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/help.ts
diff options
context:
space:
mode:
authorAjay <[email protected]>2022-01-24 23:27:00 -0500
committerAjay <[email protected]>2022-01-24 23:27:00 -0500
commit8d5f244d2f3980e90e7b467e82f4f67d8dc77b71 (patch)
treec9a7e410b5f3859bb874a90e1e5d490fed121783 /src/help.ts
parent8455ac8b397e5faaa46b3ada703b9920ffe11324 (diff)
downloadSponsorBlock-8d5f244d2f3980e90e7b467e82f4f67d8dc77b71.tar.gz
SponsorBlock-8d5f244d2f3980e90e7b467e82f4f67d8dc77b71.zip
Dark mode unless explicitely disabled (sorry)
Diffstat (limited to 'src/help.ts')
-rw-r--r--src/help.ts12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/help.ts b/src/help.ts
index 4c101c64..a3d7a9f8 100644
--- a/src/help.ts
+++ b/src/help.ts
@@ -9,16 +9,12 @@ window.addEventListener('DOMContentLoaded', init);
async function init() {
utils.localizeHtmlPage();
- //switch to light mode when requested, except for Chrome on Linux or older Windows/Mac versions, where Chrome doesn't support themes
- if (window.matchMedia("(prefers-color-scheme: light)")?.matches &&
- !(navigator.vendor == "Google Inc." && (navigator.userAgent.includes("Linux") ||
- navigator.userAgent.includes("Windows NT 6") ||
- navigator.userAgent.includes("Mac OS X") && navigator.userAgent.match(/Mac OS X [^)]+/)[0] < "Mac OS X 10_14") &&
- !navigator.userAgent.includes("OPR/") && !navigator.userAgent.includes("Edg/")))
- document.documentElement.setAttribute("data-theme", "light");
-
await utils.wait(() => Config.config !== null);
+ if (Config.config.lightMode) {
+ document.documentElement.setAttribute("data-theme", "light");
+ }
+
if (!showDonationLink()) {
document.getElementById("sbDonate").style.display = "none";
}