Skip to content

Commit

Permalink
fix: 🐛 Backport Darkmode to v11
Browse files Browse the repository at this point in the history
Fixed #447
  • Loading branch information
aMediocreDad committed Aug 15, 2024
1 parent e732f8a commit 2446079
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/yellow-tips-beg.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"forbidden-lands": patch
---

Backported the Dark mode setting to v11 as it was only native to v12
4 changes: 2 additions & 2 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions src/forbidden-lands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down
10 changes: 10 additions & 0 deletions src/system/core/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 2446079

Please sign in to comment.