From 24460790cf06a293ca38d9f1ca4bc4caf6a28852 Mon Sep 17 00:00:00 2001 From: aMediocreDad Date: Fri, 16 Aug 2024 00:14:42 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20Backport=20Darkmode=20to?= =?UTF-8?q?=20v11?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed #447 --- .changeset/yellow-tips-beg.md | 5 +++++ lang/en.json | 4 ++-- src/forbidden-lands.ts | 3 +++ src/system/core/settings.js | 10 ++++++++++ 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 .changeset/yellow-tips-beg.md diff --git a/.changeset/yellow-tips-beg.md b/.changeset/yellow-tips-beg.md new file mode 100644 index 00000000..1edeefa4 --- /dev/null +++ b/.changeset/yellow-tips-beg.md @@ -0,0 +1,5 @@ +--- +"forbidden-lands": patch +--- + +Backported the Dark mode setting to v11 as it was only native to v12 diff --git a/lang/en.json b/lang/en.json index 0c76cace..f9ac2340 100644 --- a/lang/en.json +++ b/lang/en.json @@ -377,8 +377,8 @@ "ROLL.STANDING_DODGE": "Standing dodge", "ROLL_MODIFIER.SELECT": "Please select a modifier", "SCENE.RENDER": "Toggle scene", - "SETTINGS.DARKMODE": "Dark Mode (Experimental)", - "SETTINGS.DARKMODE_HINT": "Set sheets to display in dark grey instead of white. This is an experimental feature and may give poor contrast with some sheets or UI controls.", + "SETTINGS.DARKMODE": "Dark Mode", + "SETTINGS.DARKMODE_HINT": "Set sheets to display in sepia instead of white.", "SETTINGS.REMOVEBORDERS": "Remove borders", "SETTINGS.REMOVEBORDERS_HINT": "Remove borders from the sheets to give a more minimalistic look (also improves compatibility with certain modules).", "SHEET.CLOSE": "Close", diff --git a/src/forbidden-lands.ts b/src/forbidden-lands.ts index 4def2962..396d4d1d 100644 --- a/src/forbidden-lands.ts +++ b/src/forbidden-lands.ts @@ -75,6 +75,9 @@ Hooks.once("init", () => { // Remove borders if the setting is enabled if (game.settings.get("forbidden-lands", "removeBorders")) $("html").addClass("no-borders"); + + if (game.settings.get("forbidden-lands", "darkmode")) + $("body").addClass("theme-dark"); }); Hooks.once("ready", () => { diff --git a/src/system/core/settings.js b/src/system/core/settings.js index 76dad6b7..13f59624 100644 --- a/src/system/core/settings.js +++ b/src/system/core/settings.js @@ -319,6 +319,16 @@ export default function registerSettings() { /* -------------------------------------------- */ /* Visible */ /* -------------------------------------------- */ + if (Number(game.version?.slice(0, 2)) < 12) + game.settings.register("forbidden-lands", "darkmode", { + name: "SETTINGS.DARKMODE", + hint: "SETTINGS.DARKMODE_HINT", + scope: "client", + config: true, + default: false, + requiresReload: true, + type: Boolean, + }); game.settings.register("forbidden-lands", "removeBorders", { name: "SETTINGS.REMOVEBORDERS",