Watch
0
0
Fork
You've already forked hyperhive
0

frontend: remove the stylix overlay and add hyperhive and Catppuccin light and dark themes

This commit is contained in:
iris 2026-11-22 16:43:49 +01:00 • committed by mara
commit 91e2d26133

View file

@ -0,0 +1,36 @@
// The theme registry and how a stored choice reads. Run by `npm test`, which
// imports the `.ts` module as it is.
import assert from "node:assert/strict";
import { test } from "node:test";
import {
AUTO_THEME,
DEFAULT_THEME,
THEMES,
themeChoice,
} from "../../shared/src/settings/themes.ts";
test("the default is one of the themes", () => {
assert.ok(THEMES.some((t) => t.id === DEFAULT_THEME));
});
test("every theme is light or dark, and the ids and labels are distinct", () => {
for (const t of THEMES) assert.ok(["light", "dark"].includes(t.scheme));
assert.equal(new Set(THEMES.map((t) => t.id)).size, THEMES.length);
assert.equal(new Set(THEMES.map((t) => t.label)).size, THEMES.length);
});
test("a theme id and auto read as themselves", () => {
assert.equal(themeChoice("catppuccin-mocha-mauve"), "catppuccin-mocha-mauve");
assert.equal(themeChoice(AUTO_THEME), AUTO_THEME);
});
test("the values from before themes existed read as their successors", () => {
assert.equal(themeChoice("system"), AUTO_THEME);
assert.equal(themeChoice("light"), "hyperhive-light");
assert.equal(themeChoice("dark"), "hyperhive-dark");
});
test("an unknown value reads as the fallback", () => {
assert.equal(themeChoice("blue"), DEFAULT_THEME);
assert.equal(themeChoice(undefined, "hyperhive-light"), "hyperhive-light");
});