Use the shared BGS color-blind preference

This commit is contained in:
coyotte508 2026-09-23 19:45:18 +02:00
commit b8c7ebbdaf
6 changed files with 7 additions and 7 deletions

View file

@ -105,7 +105,7 @@
],
"preferences": [
{
"name": "colorblind",
"name": "colorBlind",
"label": "Show color labels (colorblind support)",
"type": "checkbox",
"default": false

View file

@ -39,7 +39,7 @@ Fuji has a shared win/loss. The wrapper gives all players the same ranking and r
## Viewer preferences
`colorblind` is a boolean UI preference, false by default. The viewer reads the platform `preferences` event and emits `update:preference` with `{ name: "colorblind", value: boolean }` when changed in Help. It adds color names to dice and color initials to map requirement symbols without changing game state. The local harness persists the same setting in localStorage. The draft registration declares the checkbox for the platform sidebar.
`colorBlind` is the platform’s shared color-blind preference, false by default. It is stored on the BGS account and used across supported games. The viewer reads the platform `preferences` event and emits `update:preference` with `{ name: "colorBlind", value: boolean }` when changed in Help. It adds color names to dice and color initials to map requirement symbols without changing game state. The local harness persists the same setting in localStorage. The draft registration declares the checkbox so the platform shows its shared control. Incoming preference updates must not write back to the host.
## Automatic movement resolution

View file

@ -1,6 +1,6 @@
{
"name": "fuji-viewer",
"version": "0.1.3",
"version": "0.1.4",
"private": true,
"license": "AGPL-3.0-only",
"type": "module",

View file

@ -83,7 +83,7 @@ export class Store {
savePreference: (name: string, value: boolean) => void = () => {};
setColorblind(value: boolean) {
this.colorblind = value;
this.savePreference("colorblind", value);
this.savePreference("colorBlind", value);
}
send: (move: Move) => void = () => {};
selectSeat: (seat: number) => void = () => {};

View file

@ -26,7 +26,7 @@ registerViewer<View, Move>(
},
onPreferences(preferences) {
store.analysis = preferences.analysis === true;
store.colorblind = preferences.colorblind === true;
store.colorblind = preferences.colorBlind === true;
store.setSound(preferences.sound !== false);
},
onAvatars(avatars) {

View file

@ -151,14 +151,14 @@ import path from "node:path";
);
if ((await page.locator(".revealed-team .die:not(.hidden)").count()) !== 6) throw Error("Radio not rendered");
if (await page.locator(".die-caption").count()) throw Error("Color labels should be off by default");
await page.evaluate(() => window.bridge.emit("preferences", { colorblind: true }));
await page.evaluate(() => window.bridge.emit("preferences", { colorBlind: true }));
await page.waitForSelector(".die-caption");
await page.getByRole("button", { name: "Open playing guide" }).click();
await page.getByRole("checkbox", { name: "Show color labels (colorblind support)" }).uncheck();
const preference = await page.evaluate(
() => window.captured.findLast((e) => e.name === "update:preference")?.payload
);
if (preference?.name !== "colorblind" || preference.value !== false) throw Error("Wrong preference uplink");
if (preference?.name !== "colorBlind" || preference.value !== false) throw Error("Wrong preference uplink");
if (await page.locator(".die-caption").count()) throw Error("Color labels did not turn off");
await page.keyboard.press("Escape");
if ((await page.locator(".village-marker").count()) !== 5) throw Error("Every village location needs a marker");