swarm-ui: the browser chrome takes the theme's background colour
The theme-color meta was a fixed mauve, so a phone's status bar and an installed app's title bar stayed mauve under every theme, light ones included. The theme effect sets it from the computed --bg after each change, and again when the OS scheme changes under auto.
This commit is contained in:
parent
bcb432caf4
commit
868b8743d8
1 changed files with 53 additions and 0 deletions
22
frontend/packages/swarm-ui/test/theme-color.test.mjs
Normal file
22
frontend/packages/swarm-ui/test/theme-color.test.mjs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { themeColorOf } from "../../shared/src/settings/theme-color.ts";
|
||||
|
||||
test("a computed hex background is the theme colour", () => {
|
||||
assert.equal(themeColorOf(" #1e1e2e "), "#1e1e2e");
|
||||
assert.equal(themeColorOf("#fff"), "#fff");
|
||||
});
|
||||
|
||||
test("a functional colour is the theme colour", () => {
|
||||
assert.equal(themeColorOf("rgb(30, 30, 46)"), "rgb(30, 30, 46)");
|
||||
assert.equal(
|
||||
themeColorOf("color(srgb 0.1 0.1 0.2)"),
|
||||
"color(srgb 0.1 0.1 0.2)",
|
||||
);
|
||||
});
|
||||
|
||||
test("anything that isn't a colour is skipped", () => {
|
||||
assert.equal(themeColorOf(""), null);
|
||||
assert.equal(themeColorOf("var(--base00)"), null);
|
||||
assert.equal(themeColorOf("not a colour"), null);
|
||||
});
|
||||
Loading…
Reference in a new issue