From c661d4185ff3320803fad1e7dd543d2f385620ff Mon Sep 17 00:00:00 2001 From: Parsa <91623162+parsakhaz@users.noreply.github.com> Date: Mon, 14 Sep 2026 00:38:18 -0700 Subject: [PATCH] Use browser theme validation and an offline appearance bootstrap Closes #625 Closes #626 Closes #631 Closes #635 --- .github/workflows/quality.yml | 3 + AGENTS.md | 2 +- frontend/index.html | 32 +-- frontend/src/contexts/themeClasses.test.ts | 47 ---- frontend/src/index.css | 2 +- frontend/src/styles/themeContrast.test.ts | 260 --------------------- frontend/src/styles/tokens/colors.css | 16 +- frontend/src/styles/tokens/effects.css | 4 +- frontend/src/styles/tokens/typography.css | 3 +- frontend/vite.config.ts | 16 +- playwright.ci.minimal.config.ts | 2 +- scripts/README.md | 44 ++-- scripts/check-theme-contrast.mjs | 229 +++++++----------- shared/types/appearance.ts | 2 +- tests/appearance-bootstrap.spec.ts | 54 ++++- 15 files changed, 205 insertions(+), 511 deletions(-) delete mode 100644 frontend/src/contexts/themeClasses.test.ts delete mode 100644 frontend/src/styles/themeContrast.test.ts diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index 18b511e3c..3d086fefc 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -84,6 +84,9 @@ jobs: - name: Install Playwright browser dependencies run: pnpm exec playwright install --with-deps chromium + - name: Verify browser-computed theme contrast + run: pnpm theme:contrast + - name: Rebuild native modules for Electron smoke tests run: pnpm run electron:rebuild diff --git a/AGENTS.md b/AGENTS.md index f6e5551a9..4050cbeac 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -14,7 +14,7 @@ - Lint: `pnpm lint`; Type-check: `pnpm typecheck` (runs per package). The root lint command is the single entry point for blocking Oxlint and Knip checks, residual ESLint, and advisory anti-slop checks. - Detailed advisory output: `pnpm lint:ox:extra:details`; accessibility scan: `pnpm a11y:scan` (install Chromium once with `pnpm exec playwright install chromium`); opt-in render evidence: `pnpm perf:scan`. - Tests (E2E): `pnpm test`, `pnpm test:ui`, CI configs in `playwright.ci*.config.ts`. -- Themes: `pnpm theme:contrast` gates the 15 batch themes' token pairs in `frontend/src/styles/tokens/colors.css` (text/UI/terminal contrast, high-contrast overlay, CVD separation; `--all` reports the original twelve, `--themes a,b` picks themes, `--markdown --cvd` prints PR tables — see `scripts/README.md`); `pnpm theme:screenshots` regenerates `screenshots/themes/batch/`. +- Themes: `pnpm theme:contrast` gates every theme's muted text plus the 15 batch themes' token pairs in `frontend/src/styles/tokens/colors.css` (text/UI/terminal contrast, high-contrast overlay, CVD separation; `--all` reports all themes without enforcing thresholds, `--themes a,b` picks themes, `--markdown --cvd` prints PR tables — see `scripts/README.md`); `pnpm theme:screenshots` regenerates `screenshots/themes/batch/`. - Main unit tests (if added): `pnpm --filter main test`, coverage: `pnpm --filter main run test:coverage`. - Releases must follow `docs/RELEASE_INSTRUCTIONS.md` and run from a clean `main` checkout whose `HEAD` matches `origin/main`. diff --git a/frontend/index.html b/frontend/index.html index b751f9a80..2855a9a3c 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -9,37 +9,9 @@ Pane