Skip to content

Commit

Permalink
fix: 🐛 Dark Mode use Foundry native implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
aMediocreDad committed Jul 22, 2024
1 parent 8b4fe2b commit c26b1ff
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 19 deletions.
5 changes: 5 additions & 0 deletions .changeset/funny-glasses-double.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"forbidden-lands": patch
---

Dark mode is now toggled through the Foundry core settings (which use the browser settings as default). Fixes to some rendering issues in dark mode
3 changes: 0 additions & 3 deletions src/forbidden-lands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ Hooks.once("init", () => {
registerFonts();
modifyConfig();

// Add dark mode class to html tag
if (game.settings.get("forbidden-lands", "darkmode"))
$("html").addClass("dark");
// Remove borders if the setting is enabled
if (game.settings.get("forbidden-lands", "removeBorders"))
$("html").addClass("no-borders");
Expand Down
11 changes: 0 additions & 11 deletions src/system/core/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,17 +320,6 @@ export default function registerSettings() {
/* Visible */
/* -------------------------------------------- */

// System Settings
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",
hint: "SETTINGS.REMOVEBORDERS_HINT",
Expand Down
11 changes: 7 additions & 4 deletions src/system/core/styles/_index.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@forward "variables";

html.dark {
body.theme-dark {

#sidebar,
#players,
Expand All @@ -13,7 +13,10 @@ html.dark {
#hotbar #hotbar-directory-controls,
#navigation #nav-toggle,
#navigation #scene-list .scene.view,
.app.window-app {
.app.window-app,
.app.dialog,
.application.dialog,
.application.window-app {
border-image-source: url(./assets/journal-art/box-border-large-dark.webp);
}

Expand Down Expand Up @@ -46,7 +49,7 @@ html.dark {
.journal-page-header h1,
.journal-page-header h2,
.journal-page-header h3 {
color: var(--color-theme-background);
color: var(--color-theme-text);
}

.journal-sheet .journal-header .title {
Expand All @@ -59,7 +62,7 @@ html.dark {
}

html.no-borders,
html.dark.no-borders {
html.no-borders body.theme-dark {

#sidebar,
#players,
Expand Down
3 changes: 2 additions & 1 deletion src/system/core/styles/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,13 @@ body {
--line-height-30: 1.875rem;
}

html.dark {
body.theme-dark {
--color-theme-background: var(--color-theme-alt-1000);
--color-theme-alt-600: var(--color-theme-gray-600);
--color-theme-alt-800: var(--color-theme-gray-800);
--color-theme-gray-200: #dddddd96;
--color-highlight: #f0f0e0;
--color-text-dark-5: #555;
--color-text-dark-6: #555;
--color-light-3: var(--color-highlight);
}

0 comments on commit c26b1ff

Please sign in to comment.