Store: status words follow the theme (ok/warn/danger ink tokens), with a token test
A literal #3ecf8e green read 1.03:1 on the Windows 98 silver card (theme QA r1). Status text now mixes the status hue toward --wb-text; store.css may hold no literal text colours outside its token defaults.
This commit is contained in:
parent
c939fd2bc5
commit
7fc23b1953
2 changed files with 41 additions and 14 deletions
|
|
@ -16,6 +16,10 @@
|
||||||
--wb-hover: rgb(238 240 247 / .06); --wb-press: rgb(238 240 247 / .1);
|
--wb-hover: rgb(238 240 247 / .06); --wb-press: rgb(238 240 247 / .1);
|
||||||
--wb-accent: #1d9bf0; --wb-accent-rgb: 29 155 240; --wb-accent-soft: rgb(29 155 240 / .14); --wb-accent-ink: #cfe6ff; --wb-on-accent: #fff;
|
--wb-accent: #1d9bf0; --wb-accent-rgb: 29 155 240; --wb-accent-soft: rgb(29 155 240 / .14); --wb-accent-ink: #cfe6ff; --wb-on-accent: #fff;
|
||||||
--wb-ok: #3ecf8e; --wb-warn: #ffb020;
|
--wb-ok: #3ecf8e; --wb-warn: #ffb020;
|
||||||
|
/* Status words on any card: the status hue pulled toward the text colour, so green/amber text stays
|
||||||
|
readable on light and silver themes too (a raw #3ecf8e was 1.03:1 on Windows 98 silver). */
|
||||||
|
--wb-ok-ink: color-mix(in oklab, var(--wb-ok) 42%, var(--wb-text)); --wb-warn-ink: color-mix(in oklab, var(--wb-warn) 42%, var(--wb-text));
|
||||||
|
--wb-danger-ink: color-mix(in oklab, #ff5c6c 50%, var(--wb-text));
|
||||||
--wb-font: system-ui, sans-serif; --wb-font-mono: ui-monospace, monospace;
|
--wb-font: system-ui, sans-serif; --wb-font-mono: ui-monospace, monospace;
|
||||||
--wb-shadow-pop: 0 18px 44px -14px rgba(0, 0, 0, .75), 0 3px 10px rgba(0, 0, 0, .35);
|
--wb-shadow-pop: 0 18px 44px -14px rgba(0, 0, 0, .75), 0 3px 10px rgba(0, 0, 0, .35);
|
||||||
--wb-ring: 0 0 0 2px rgb(29 155 240 / .6);
|
--wb-ring: 0 0 0 2px rgb(29 155 240 / .6);
|
||||||
|
|
@ -58,13 +62,13 @@
|
||||||
background: var(--wb-field); box-shadow: inset 0 0 0 1px var(--wb-border);
|
background: var(--wb-field); box-shadow: inset 0 0 0 1px var(--wb-border);
|
||||||
}
|
}
|
||||||
.wbi-source > svg { flex: none; color: var(--wb-muted); }
|
.wbi-source > svg { flex: none; color: var(--wb-muted); }
|
||||||
.wbi-source.is-store > svg { color: #3ecf8e; }
|
.wbi-source.is-store > svg { color: var(--wb-ok-ink); }
|
||||||
.wbi-source > div { min-width: 0; flex: 1; display: grid; gap: 2px; }
|
.wbi-source > div { min-width: 0; flex: 1; display: grid; gap: 2px; }
|
||||||
.wbi-source strong { font-weight: 600; }
|
.wbi-source strong { font-weight: 600; }
|
||||||
.wbi-source code { font: 12px/1.4 var(--wb-font-mono); color: var(--wb-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
.wbi-source code { font: 12px/1.4 var(--wb-font-mono); color: var(--wb-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||||
.wbi-verified {
|
.wbi-verified {
|
||||||
flex: none; display: inline-flex; align-items: center; gap: 5px; padding-block: 4px; padding-inline: 7px 9px; border-radius: 999px;
|
flex: none; display: inline-flex; align-items: center; gap: 5px; padding-block: 4px; padding-inline: 7px 9px; border-radius: 999px;
|
||||||
font: 600 11.5px/1 var(--wb-font); color: #3ecf8e; background: rgb(62 207 142 / .12); box-shadow: inset 0 0 0 1px rgb(62 207 142 / .35);
|
font: 600 11.5px/1 var(--wb-font); color: var(--wb-ok-ink); background: rgb(62 207 142 / .12); box-shadow: inset 0 0 0 1px rgb(62 207 142 / .35);
|
||||||
}
|
}
|
||||||
.wbi-desc { margin: 0; color: var(--wb-text-2); }
|
.wbi-desc { margin: 0; color: var(--wb-text-2); }
|
||||||
|
|
||||||
|
|
@ -87,17 +91,17 @@
|
||||||
justify-self: start; padding: 3px 9px; border-radius: 999px; font: 600 11.5px/1.3 var(--wb-font);
|
justify-self: start; padding: 3px 9px; border-radius: 999px; font: 600 11.5px/1.3 var(--wb-font);
|
||||||
background: rgb(var(--wb-text-rgb) / .07); color: var(--wb-text); box-shadow: inset 0 0 0 1px var(--wb-border-strong);
|
background: rgb(var(--wb-text-rgb) / .07); color: var(--wb-text); box-shadow: inset 0 0 0 1px var(--wb-border-strong);
|
||||||
}
|
}
|
||||||
.wbi-perms li.is-warn .wbi-chip { background: rgb(255 176 32 / .12); color: #ffc55c; box-shadow: inset 0 0 0 1px rgb(255 176 32 / .35); }
|
.wbi-perms li.is-warn .wbi-chip { background: rgb(255 176 32 / .12); color: var(--wb-warn-ink); box-shadow: inset 0 0 0 1px rgb(255 176 32 / .35); }
|
||||||
.wbi-perms li.is-ok .wbi-chip { background: rgb(62 207 142 / .12); color: #58d9a0; box-shadow: inset 0 0 0 1px rgb(62 207 142 / .32); }
|
.wbi-perms li.is-ok .wbi-chip { background: rgb(62 207 142 / .12); color: var(--wb-ok-ink); box-shadow: inset 0 0 0 1px rgb(62 207 142 / .32); }
|
||||||
.wbi-note { display: flex; gap: 8px; margin: 10px 0 0; padding: 9px 11px; border-radius: 10px; color: var(--wb-text-2); background: rgb(var(--wb-text-rgb) / .035); font-size: 12.5px; }
|
.wbi-note { display: flex; gap: 8px; margin: 10px 0 0; padding: 9px 11px; border-radius: 10px; color: var(--wb-text-2); background: rgb(var(--wb-text-rgb) / .035); font-size: 12.5px; }
|
||||||
.wbi-note svg { flex: none; margin-top: 2px; color: #ffc55c; }
|
.wbi-note svg { flex: none; margin-top: 2px; color: var(--wb-warn-ink); }
|
||||||
.wbi-findings { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 12.5px; color: var(--wb-text-2); }
|
.wbi-findings { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 12.5px; color: var(--wb-text-2); }
|
||||||
.wbi-findings strong { margin-inline-end: 2px; }
|
.wbi-findings strong { margin-inline-end: 2px; }
|
||||||
.wbi-findings span { padding: 2px 8px; border-radius: 6px; background: rgb(255 176 32 / .1); color: #ffc55c; }
|
.wbi-findings span { padding: 2px 8px; border-radius: 6px; background: rgb(255 176 32 / .1); color: var(--wb-warn-ink); }
|
||||||
|
|
||||||
.wbi-theme { display: grid; gap: 8px; }
|
.wbi-theme { display: grid; gap: 8px; }
|
||||||
.wbi-theme-preview { border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 1px var(--wb-border); }
|
.wbi-theme-preview { border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 1px var(--wb-border); }
|
||||||
.wbi-warnings { margin: 0; padding-inline-start: 18px; color: #ffc55c; font-size: 12.5px; }
|
.wbi-warnings { margin: 0; padding-inline-start: 18px; color: var(--wb-warn-ink); font-size: 12.5px; }
|
||||||
|
|
||||||
.wbi-code { direction: ltr; border-radius: 12px; background: var(--wb-ground); box-shadow: inset 0 0 0 1px var(--wb-border); overflow: hidden; }
|
.wbi-code { direction: ltr; border-radius: 12px; background: var(--wb-ground); box-shadow: inset 0 0 0 1px var(--wb-border); overflow: hidden; }
|
||||||
.wbi-code header { display: flex; justify-content: space-between; align-items: baseline; padding: 9px 12px; border-bottom: 1px solid var(--wb-border-soft); font-weight: 600; }
|
.wbi-code header { display: flex; justify-content: space-between; align-items: baseline; padding: 9px 12px; border-bottom: 1px solid var(--wb-border-soft); font-weight: 600; }
|
||||||
|
|
@ -126,8 +130,8 @@
|
||||||
.wbi-state .wbi-muted { color: var(--wb-muted); font-size: 12.5px; }
|
.wbi-state .wbi-muted { color: var(--wb-muted); font-size: 12.5px; }
|
||||||
.wbi-state-actions { display: flex; gap: 10px; margin-top: 14px; }
|
.wbi-state-actions { display: flex; gap: 10px; margin-top: 14px; }
|
||||||
.wbi-state-icon { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; }
|
.wbi-state-icon { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; }
|
||||||
.wbi-state-icon.is-ok { color: #3ecf8e; background: rgb(62 207 142 / .12); box-shadow: inset 0 0 0 1px rgb(62 207 142 / .35); }
|
.wbi-state-icon.is-ok { color: var(--wb-ok-ink); background: rgb(62 207 142 / .12); box-shadow: inset 0 0 0 1px rgb(62 207 142 / .35); }
|
||||||
.wbi-state-icon.is-warn { color: #ffc55c; background: rgb(255 176 32 / .12); box-shadow: inset 0 0 0 1px rgb(255 176 32 / .35); }
|
.wbi-state-icon.is-warn { color: var(--wb-warn-ink); background: rgb(255 176 32 / .12); box-shadow: inset 0 0 0 1px rgb(255 176 32 / .35); }
|
||||||
.wbi-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgb(var(--wb-text-rgb) / .1); border-top-color: var(--wb-accent); animation: wbi-spin .8s linear infinite; }
|
.wbi-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgb(var(--wb-text-rgb) / .1); border-top-color: var(--wb-accent); animation: wbi-spin .8s linear infinite; }
|
||||||
@keyframes wbi-spin { to { transform: rotate(360deg); } }
|
@keyframes wbi-spin { to { transform: rotate(360deg); } }
|
||||||
|
|
||||||
|
|
@ -167,7 +171,7 @@
|
||||||
.wbs-cats-end { flex: 1; }
|
.wbs-cats-end { flex: 1; }
|
||||||
.wbs-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--wb-muted); }
|
.wbs-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--wb-muted); }
|
||||||
.wbs-status.is-ok svg { color: var(--wb-ok); }
|
.wbs-status.is-ok svg { color: var(--wb-ok); }
|
||||||
.wbs-status.is-warn { color: var(--wb-warn); }
|
.wbs-status.is-warn { color: var(--wb-warn-ink); }
|
||||||
.wbs-updates {
|
.wbs-updates {
|
||||||
display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 10px 14px; border-radius: 12px;
|
display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 10px 14px; border-radius: 12px;
|
||||||
background: var(--wb-accent-soft); border: 1px solid rgb(var(--wb-accent-rgb) / .35); color: var(--wb-text-2);
|
background: var(--wb-accent-soft); border: 1px solid rgb(var(--wb-accent-rgb) / .35); color: var(--wb-text-2);
|
||||||
|
|
@ -196,11 +200,11 @@
|
||||||
.wbs-desc { margin: 0; color: var(--wb-text-2); font-size: 12.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
|
.wbs-desc { margin: 0; color: var(--wb-text-2); font-size: 12.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
|
||||||
.wbs-perms { display: flex; flex-wrap: wrap; gap: 5px; list-style: none; margin: 2px 0 0; padding: 0; }
|
.wbs-perms { display: flex; flex-wrap: wrap; gap: 5px; list-style: none; margin: 2px 0 0; padding: 0; }
|
||||||
.wbs-perms li { padding: 2px 8px; border-radius: 999px; font-size: 11px; line-height: 1.5; color: var(--wb-text-2); background: rgb(var(--wb-text-rgb) / .06); border: 1px solid var(--wb-border); }
|
.wbs-perms li { padding: 2px 8px; border-radius: 999px; font-size: 11px; line-height: 1.5; color: var(--wb-text-2); background: rgb(var(--wb-text-rgb) / .06); border: 1px solid var(--wb-border); }
|
||||||
.wbs-perms li.is-warn { color: var(--wb-warn); border-color: color-mix(in srgb, var(--wb-warn) 40%, transparent); background: color-mix(in srgb, var(--wb-warn) 10%, transparent); }
|
.wbs-perms li.is-warn { color: var(--wb-warn-ink); border-color: color-mix(in srgb, var(--wb-warn) 40%, transparent); background: color-mix(in srgb, var(--wb-warn) 10%, transparent); }
|
||||||
.wbs-perms li.is-ok { color: var(--wb-ok); border-color: color-mix(in srgb, var(--wb-ok) 35%, transparent); background: color-mix(in srgb, var(--wb-ok) 9%, transparent); }
|
.wbs-perms li.is-ok { color: var(--wb-ok-ink); border-color: color-mix(in srgb, var(--wb-ok) 35%, transparent); background: color-mix(in srgb, var(--wb-ok) 9%, transparent); }
|
||||||
.wbs-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: auto; padding-top: 8px; }
|
.wbs-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: auto; padding-top: 8px; }
|
||||||
.wbs-state { font-size: 12px; color: var(--wb-muted); margin-inline-end: auto; }
|
.wbs-state { font-size: 12px; color: var(--wb-muted); margin-inline-end: auto; }
|
||||||
.wbs-state.is-ok { color: var(--wb-ok); }
|
.wbs-state.is-ok { color: var(--wb-ok-ink); }
|
||||||
.wbs-foot { margin: 4px 0 0; color: var(--wb-muted); font-size: 12.5px; }
|
.wbs-foot { margin: 4px 0 0; color: var(--wb-muted); font-size: 12.5px; }
|
||||||
.wbs-foot code { font-family: var(--wb-font-mono, ui-monospace, monospace); color: var(--wb-text-2); }
|
.wbs-foot code { font-family: var(--wb-font-mono, ui-monospace, monospace); color: var(--wb-text-2); }
|
||||||
|
|
||||||
|
|
@ -215,7 +219,7 @@
|
||||||
.wb-btn:disabled { opacity: .5; cursor: default; }
|
.wb-btn:disabled { opacity: .5; cursor: default; }
|
||||||
.wb-btn.is-primary { background: var(--wb-accent); border-color: transparent; color: var(--wb-on-accent); }
|
.wb-btn.is-primary { background: var(--wb-accent); border-color: transparent; color: var(--wb-on-accent); }
|
||||||
.wb-btn.is-ghost { background: transparent; border-color: transparent; color: var(--wb-text-2); }
|
.wb-btn.is-ghost { background: transparent; border-color: transparent; color: var(--wb-text-2); }
|
||||||
.wb-btn.is-danger { background: color-mix(in srgb, #f4212e 16%, transparent); border-color: color-mix(in srgb, #f4212e 45%, transparent); color: #ff7b85; }
|
.wb-btn.is-danger { background: color-mix(in srgb, #f4212e 16%, transparent); border-color: color-mix(in srgb, #f4212e 45%, transparent); color: var(--wb-danger-ink); }
|
||||||
.wb-icon-btn { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--wb-muted); cursor: pointer; }
|
.wb-icon-btn { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--wb-muted); cursor: pointer; }
|
||||||
.wb-icon-btn:hover { background: var(--wb-hover); color: var(--wb-text); }
|
.wb-icon-btn:hover { background: var(--wb-hover); color: var(--wb-text); }
|
||||||
.wb-field { height: 32px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--wb-border); background: var(--wb-field); color: var(--wb-text); font: 13px var(--wb-font); }
|
.wb-field { height: 32px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--wb-border); background: var(--wb-field); color: var(--wb-text); font: 13px var(--wb-font); }
|
||||||
|
|
|
||||||
23
packages/shell/tests/themeTokens.test.ts
Normal file
23
packages/shell/tests/themeTokens.test.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
// Theme QA bug class "fixed status colour on a themed card": the Store and install screen are themed through
|
||||||
|
// --wb-* tokens, so no text colour there may be a literal (a raw #3ecf8e green was 1.03:1 on Windows 98
|
||||||
|
// silver). Literals are allowed only in the token default block; text uses --wb-*-ink or other tokens.
|
||||||
|
import { test } from 'node:test';
|
||||||
|
import assert from 'node:assert/strict';
|
||||||
|
import { readFileSync } from 'node:fs';
|
||||||
|
import { join } from 'node:path';
|
||||||
|
|
||||||
|
const css = readFileSync(join(import.meta.dirname, '../src/store.css'), 'utf8');
|
||||||
|
|
||||||
|
test('store.css: no literal text colours outside the token defaults', () => {
|
||||||
|
const body = css.replace(/:where\(\.wbs, \.wbi-backdrop, \.wbi-drop\) \{[\s\S]*?\n\}/, '').replace(/\/\*[\s\S]*?\*\//g, '');
|
||||||
|
const literal = [...body.matchAll(/(?<![-\w])color:\s*(#[0-9a-f]{3,8}|rgba?\([^)]*\))/gi)].map(m => m[0]);
|
||||||
|
const allowed = literal.filter(d => !/#fff\b|#ffffff|rgba?\(0,? 0,? 0/i.test(d));
|
||||||
|
assert.deepEqual(allowed, [], 'use var(--wb-ok-ink)/var(--wb-warn-ink) or another --wb-* token');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('store.css: status words use the ink tokens', () => {
|
||||||
|
for (const sel of ['.wbs-state.is-ok', '.wbs-perms li.is-ok', '.wbs-perms li.is-warn', '.wbs-status.is-warn']) {
|
||||||
|
const rule = css.slice(css.indexOf(sel)).split('}')[0];
|
||||||
|
assert.match(rule, /color: var\(--wb-(ok|warn)-ink\)/, sel);
|
||||||
|
}
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue