feat(web): refresh the app with Astryx and coral branding
This commit is contained in:
1 parent
f649490cd2
commit
da7b502936
140 files changed
+4531
-2368
No files matched your search
@@ -8,10 +8,10 @@ const stylesheet = await readFile(
|
||||
);
|
||||
|
||||
const BRAND_COLORS = {
|
||||
coral: "oklch(0.708008 0.234375 24)",
|
||||
violet: "oklch(0.481934 0.285938 285)",
|
||||
gold: "oklch(0.853027 0.2 90)",
|
||||
cyan: "oklch(70% 0.14523 200)",
|
||||
coral: "oklch(70.8008% .234375 24)",
|
||||
ink: "#22252e",
|
||||
gold: "#f2b01e",
|
||||
leaf: "#2f9e58",
|
||||
} as const;
|
||||
|
||||
test("defines each brand color once as a primitive token", () => {
|
||||
@@ -28,48 +28,67 @@ test("defines each brand color once as a primitive token", () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("maps the light theme semantic roles to the brand primitives", () => {
|
||||
const lightTheme = cssBlocksForSelector('[data-theme="light"]');
|
||||
test("keeps the layer order that lets LOLYMPUS tokens override Astryx", () => {
|
||||
assert.match(
|
||||
stylesheet,
|
||||
/@layer reset, theme, base, astryx-base, astryx-theme, lolympus, components, utilities;/,
|
||||
);
|
||||
assert.doesNotMatch(stylesheet, /daisyui/);
|
||||
});
|
||||
|
||||
test("derives Astryx action colors from the brand coral", () => {
|
||||
assert.match(
|
||||
stylesheet,
|
||||
/--color-accent: var\(--color-brand-coral\);/,
|
||||
);
|
||||
assert.match(
|
||||
stylesheet,
|
||||
/--color-text-accent: light-dark\(\s*color-mix\(in oklab, var\(--color-brand-coral\) \d+%, black\),\s*color-mix\(in oklab, var\(--color-brand-coral\) \d+%, white\)\s*\);/,
|
||||
);
|
||||
});
|
||||
|
||||
test("separates fill and text colors for primary and result roles", () => {
|
||||
const mappings = [
|
||||
["--color-primary", "--color-brand-coral"],
|
||||
["--color-secondary", "--color-brand-violet"],
|
||||
["--color-accent", "--color-brand-gold"],
|
||||
["--color-info", "--color-brand-cyan"],
|
||||
["--color-primary", "--color-accent"],
|
||||
["--text-color-primary", "--color-text-accent"],
|
||||
["--color-win", "--lts-win-fill"],
|
||||
["--text-color-win", "--lts-win"],
|
||||
["--color-loss", "--lts-loss-fill"],
|
||||
["--text-color-loss", "--lts-loss"],
|
||||
["--color-bracket-winner", "--color-text-accent"],
|
||||
] as const;
|
||||
|
||||
for (const [semanticToken, primitiveToken] of mappings) {
|
||||
for (const [utilityToken, roleToken] of mappings) {
|
||||
assert.match(
|
||||
lightTheme,
|
||||
stylesheet,
|
||||
new RegExp(
|
||||
`${escapeRegExp(semanticToken)}: var\\(${escapeRegExp(primitiveToken)}\\);`,
|
||||
`${escapeRegExp(utilityToken)}: var\\(${escapeRegExp(roleToken)}\\);`,
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
test("keeps coral scopes without overriding the global dark primary", () => {
|
||||
assert.match(
|
||||
stylesheet,
|
||||
/--color-bracket-winner: var\(--color-brand-coral\);/,
|
||||
);
|
||||
assert.match(
|
||||
stylesheet,
|
||||
/\.competition-series-history\s*{\s*--color-primary: var\(--color-brand-coral\);\s*}/,
|
||||
);
|
||||
test("defines every role color for both light and dark", () => {
|
||||
const roleTokens = [
|
||||
"--lts-ink",
|
||||
"--lts-win",
|
||||
"--lts-win-tint",
|
||||
"--lts-loss",
|
||||
"--lts-loss-tint",
|
||||
"--lts-gold",
|
||||
"--lts-leaf",
|
||||
"--lts-sunken",
|
||||
];
|
||||
|
||||
const darkTheme = cssBlocksForSelector('[data-theme="dark"]');
|
||||
assert.doesNotMatch(darkTheme, /--color-primary/);
|
||||
for (const token of roleTokens) {
|
||||
assert.match(
|
||||
stylesheet,
|
||||
new RegExp(`${escapeRegExp(token)}: light-dark\\(`),
|
||||
`${token} should use light-dark()`,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
function cssBlocksForSelector(selector: string): string {
|
||||
const blocks = stylesheet.matchAll(
|
||||
new RegExp(`${escapeRegExp(selector)}\\s*{([^}]*)}`, "g"),
|
||||
);
|
||||
const contents = [...blocks].map((match) => match[1] ?? "").join("\n");
|
||||
assert.notEqual(contents, "", `${selector} should have a CSS block`);
|
||||
return contents;
|
||||
}
|
||||
|
||||
function escapeRegExp(value: string): string {
|
||||
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
}
|
||||
Reference in new issue
Block a user