diff --git a/viewer/theme.js b/viewer/theme.js new file mode 100644 index 0000000..31fc3b5 --- /dev/null +++ b/viewer/theme.js @@ -0,0 +1,2 @@ +// Temporary presentation override; keep both palettes for a future theme choice. +export const FORCE_DARK_THEME = true; diff --git a/viewer/tutorial.js b/viewer/tutorial.js index d66ab73..667b1bc 100644 --- a/viewer/tutorial.js +++ b/viewer/tutorial.js @@ -1,3 +1,4 @@ +import { FORCE_DARK_THEME } from "./theme.js"; import { createTutorial } from "@boardgamers/protocol/tutorial"; import { stripSecret } from "../engine/index.js"; import { tutorialOptions } from "../tutorial/scenarios.js"; @@ -97,7 +98,7 @@ export async function mountTutorial( const ui = mountGame(game, { onMove: (move) => controller.play(move) }); const theme = matchMedia("(prefers-color-scheme: dark)"); function updateTheme() { - root.classList.toggle("dark", theme.matches); + root.classList.toggle("dark", FORCE_DARK_THEME || theme.matches); ui.setPreferences({ locale: t.locale, dark: theme.matches }); } updateTheme(); diff --git a/viewer/ui.js b/viewer/ui.js index 7c37d68..1a57634 100644 --- a/viewer/ui.js +++ b/viewer/ui.js @@ -1,3 +1,4 @@ +import { FORCE_DARK_THEME } from "./theme.js"; import { mergePreferences, imageUrl } from "./platform.js"; import { achievementProgress } from "./achievement-progress.js"; import { @@ -61,7 +62,7 @@ export function mountGame( } = {}, ) { const shell = document.createElement("div"); - shell.className = "pr-game"; + shell.className = `pr-game${FORCE_DARK_THEME ? " dark" : ""}`; shell.lang = "en"; shell.dir = "ltr"; shell.innerHTML = `

Chat

`; @@ -779,7 +780,7 @@ export function mountGame( "is-building", allowed() && ["build", "draft"].includes(state.tasks[0]?.kind), ); - const html = `
PUERTO RICO${t("metadata.subtitle")}
${t("round")} ${state.round}
${state.players.map(playerCard).join("")}
${playerSummary()}${localControls ? `
${t("local")}
` : ""}
${sharedBoard()}${playerBoard()}${market()}
${bottom()}
`; + const html = `
PUERTO RICO${t("metadata.subtitle")}
${t("round")} ${state.round}
${state.players.map(playerCard).join("")}
${playerSummary()}${localControls ? `
${t("local")}${FORCE_DARK_THEME ? "" : ``}
` : ""}
${sharedBoard()}${playerBoard()}${market()}
${bottom()}
`; morphdom(content, html, { childrenOnly: true, onBeforeElUpdated(from, to) { @@ -1320,7 +1321,7 @@ export function mountGame( b.setAttribute("aria-label", t("close")); shell.classList.toggle( "dark", - preferences.dark ?? preferences.theme === "dark", + FORCE_DARK_THEME || (preferences.dark ?? preferences.theme === "dark"), ); render(); },