Skip to content

Commit 9fef0ec

Browse files
committed
fix: 🐛 Backport Darkmode to v11
Fixed #447
1 parent 58baabf commit 9fef0ec

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

.changeset/yellow-tips-beg.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"forbidden-lands": patch
3+
---
4+
5+
Backported the Dark mode setting to v11 as it was only native to v12

lang/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,8 @@
377377
"ROLL.STANDING_DODGE": "Standing dodge",
378378
"ROLL_MODIFIER.SELECT": "Please select a modifier",
379379
"SCENE.RENDER": "Toggle scene",
380-
"SETTINGS.DARKMODE": "Dark Mode (Experimental)",
381-
"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.",
380+
"SETTINGS.DARKMODE": "Dark Mode",
381+
"SETTINGS.DARKMODE_HINT": "Set sheets to display in sepia instead of white.",
382382
"SETTINGS.REMOVEBORDERS": "Remove borders",
383383
"SETTINGS.REMOVEBORDERS_HINT": "Remove borders from the sheets to give a more minimalistic look (also improves compatibility with certain modules).",
384384
"SHEET.CLOSE": "Close",

src/forbidden-lands.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ Hooks.once("init", () => {
7575
// Remove borders if the setting is enabled
7676
if (game.settings.get("forbidden-lands", "removeBorders"))
7777
$("html").addClass("no-borders");
78+
79+
if (game.settings.get("forbidden-lands", "darkmode"))
80+
$("body").addClass("theme-dark");
7881
});
7982

8083
Hooks.once("ready", () => {

src/system/core/settings.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,16 @@ export default function registerSettings() {
319319
/* -------------------------------------------- */
320320
/* Visible */
321321
/* -------------------------------------------- */
322+
if (Number(game.version?.slice(0, 2)) < 12)
323+
game.settings.register("forbidden-lands", "darkmode", {
324+
name: "SETTINGS.DARKMODE",
325+
hint: "SETTINGS.DARKMODE_HINT",
326+
scope: "client",
327+
config: true,
328+
default: false,
329+
requiresReload: true,
330+
type: Boolean,
331+
});
322332

323333
game.settings.register("forbidden-lands", "removeBorders", {
324334
name: "SETTINGS.REMOVEBORDERS",

0 commit comments

Comments
 (0)