Skip to content

emrg: gui — use theme variables in React shell (fix light theme regression) - #1047

Merged
argszero merged 1 commit into
masterfrom
feature/react-shell-theme-vars
Aug 27, 2026
Merged

emrg: gui — use theme variables in React shell (fix light theme regression)#1047
argszero merged 1 commit into
masterfrom
feature/react-shell-theme-vars

Conversation

@argszero

Copy link
Copy Markdown
Owner

Problem

The GUI's light theme is broken: after selecting 外观 = 浅色 (light), the main interface stays dark. Root cause confirmed by host (rant 2026-08-27T20:33:31): before the React migration the light theme worked fine, but the React shell (.react-shell and its children) hardcodes Catppuccin dark colors (#1e1e2e / #cdd6f4 / #89b4fa / etc.) instead of using the theme variables from tokens.css. This was introduced by Batch 0 (#991) and the layout fix (#1040) only addressed layout classes, not color-theme wiring.

Fix

Replace all hardcoded Catppuccin colors in emrg/gui/renderer/src/shell.css with the CSS custom properties already defined in css/tokens.css:

  • .react-shell background/color → var(--bg) / var(--text-1)
  • header/divider borders → var(--border)
  • badge → var(--accent-soft) / var(--accent)
  • side-nav item states → var(--text-2) / var(--bg-soft) / var(--text-1) / var(--accent)
  • workspace-view-title → var(--text-1)
  • conn-dot green/gray → var(--accent) / var(--text-3)
  • error-boundary card/summary/actions → var(--bg-panel) / var(--border) / var(--shadow-lg) / var(--text-*)

The theme is driven by the data-theme attribute (light/dark/system) set in SettingsPanel.tsx and resolved by tokens.css; using these variables makes the React shell correct in all three states (light, dark, follow-system) — matching pre-migration behavior.

Verification

  • npm run build: OK (49.03 kB CSS, build succeeds)
  • npx vitest run: 445 passed / 44 files
  • pytest tests/ -v: 1126 passed + 1 skipped (collect-only 1127 == Agent.md doc-count)
  • python -c "from emrg.client.app import run_client": import OK
  • python -m emrg --help: CLI OK

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle cyc20260827-204948

Verified fresh this cycle:

  • Fix summary: all hardcoded Catppuccin dark colors in emrg/gui/renderer/src/shell.css replaced with css/tokens.css theme variables (var(--bg), var(--text-1), var(--border), var(--accent-soft), var(--accent), etc.).
  • Theme mechanism confirmed: data-theme="light" resolves --bg:\ #fafafa / --text-1:\ #1a1d21 in tokens.css, and .react-shell now uses those vars — light theme works across all three states (light/dark/follow-system).
  • No hardcoded hex/rgba(255,255,255) remains in any CSS rule on the PR branch (comment-only mention retained for traceability).
  • CI: test check passes (1m43s). test-windows pending.
  • Covers rant 2026-08-27T20:33:31 (GUI light-theme regression).

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle cyc20260827-205444 (2/3)

Re-verified fresh this cycle:

  • PR head d5fb71c unchanged since first LGTM; still clean — no hardcoded hex/rgba(255,255,255) in any CSS rule (only comment mentions retained for traceability).
  • CI: test + test-windows both pass.
  • mergeable: MERGEABLE, base master, no conflicts.
  • Covers rant 2026-08-27T20:33:31 (GUI light-theme regression).

@argszeroargszero left a comment

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle cyc20260827-205943 (3/3)

Third distinct-cycle verification:

  • PR head d5fb71c unchanged; still clean — no hardcoded hex/rgba(255,255,255) in any CSS rule.
  • CI: test + test-windows both pass.
  • mergeable: MERGEABLE, base master, no conflicts.
  • Covers rant 2026-08-27T20:33:31 (GUI light-theme regression).

3 consecutive ✅ (cycles 204948/205444/205943), no ❌ — merge gate satisfied.

@argszero
argszero merged commit c87dbf2 into masterAug 27, 2026
2 checks passed
argszero added a commit that referenced this pull request Aug 27, 2026
…egression via theme variables in React shell) (#1048)
Co-authored-by: EMRG Evolution <emrg@argszero.dev>
argszero added a commit that referenced this pull request Aug 27, 2026
…--radius-sm) + add theme-integrity guard (#1051)
* emrg: gui — fix undefined theme tokens (--fs-small/--bg-1/--bg-hover/--radius-sm) + add theme-integrity guard
Two-part change hardening renderer theming (rant 2026-08-27T20:33:31 → #1047
light-theme regression class):
FIX: tokens.css lacked 4 variables that layout.css/components.css consume as
bare var(--x) (no fallback): --fs-small (11px), --radius-sm (8px), --bg-1 and
--bg-hover (per-theme values). Bare undefined vars make declarations invalid
at computed-value time — task-form background transparent, filetab hover
dead, badge font-size/radius wrong. All 4 now defined in every theme block
(light default + forced, dark media + forced).
GUARD: emrg/gui/test/theme-guard.test.js — 2 static tests:
1. every bare var(--x) in renderer CSS must be defined in tokens.css
(catches silent invalid declarations — the bug above)
2. no Catppuccin dark-palette hexes outside tokens.css, comment-stripped
(the exact #1047 regression shape: hardcoded theme colors bypassing vars)
Negative-state verified: guard fails on pre-fix tokens, passes on fixed.
GUI tests 93 -> 95, Agent.md synced.
* test: make theme-guard scan recursive (cover src/**/*.css nested files)
---------
Co-authored-by: argszero <argszero@gmail.com>
Co-authored-by: EMRG Evolution <emrg@argszero.dev>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@argszero