Skip to content

feat: Define missing Tailwind theme tokens and consolidate design-system drift (OM-242) - #504

Merged
chriswritescode-dev merged 3 commits into
mainfrom
om-242-define-missing-tailwind-theme-tokens-and
Dec 3, 2026
Merged

chriswritescode-dev merged 3 commits into
mainfrom
om-242-define-missing-tailwind-theme-tokens-and

Conversation

@chriswritescode-dev

@chriswritescode-dev chriswritescode-dev commented Dec 3, 2026 •

Copy link
Copy Markdown
Owner

User description

What this achieves

Fixes the theme-token gaps and static/runtime drift listed in the "Design system OpenCode Manager" report. Dark mode, light mode, the OpenCode color palettes and root font-size scaling (87.5%–125%) keep working.

  • Focus rings, card text and popover text now have real theme colors. The UI kit already used ring, card-foreground and popover-foreground (in button, badge, card, checkbox, dialog, popover, select, tabs, tooltip and others), but those tokens were never defined, so the classes did nothing. Keyboard focus on UI-kit buttons now shows a visible ring.
  • Near-duplicate grays and off-scale literals are merged onto the existing palette and spacing/radius scale.
  • Small text uses a rem size, so it scales with the font-size setting. Before, pixel sizes stayed fixed.

What changed

Tokens (frontend/src/index.css, frontend/src/lib/theme/colorTheme.ts)

  • Added --color-ring, --color-card-foreground and --color-popover-foreground to both @theme (dark) and :root:not(.dark) (light):
    • dark: ring #d4d4d8, foregrounds #fafafa
    • light: ring #6b7280, foregrounds #111827
  • Registered the three tokens in MANAGER_THEME_TOKENS. resolveColorThemeTokens derives them for every OpenCode palette: ring = the palette's muted foreground, and both foregrounds = the palette ink. applyColorTheme therefore overrides them, and the boot replay restores them after a reload.

Neutral and literal consolidation (frontend/src/index.css)

  • Dark: muted and popover #18181b → #141414; accent and secondary #27272a → #2a2a2a; background-gradient #0d0d0d → #0a0a0a.
  • Light: syntax-comment #6a737d → #6b7280.
  • Mobile .prose-enhanced table cell padding 0.375rem (6px) → 0.25rem (4px). Scrollbar thumb radius 3px → var(--radius-sm).

Typography

  • Added --text-2xs: 0.625rem. In 21 component and page files, every text-[10px] and text-[11px] is now text-2xs, and every text-[15px] is now text-sm.

Tests

  • colorTheme.test.ts checks that Dracula sets the three new tokens inline and that they derive from the palette in dark and light mode. A new test checks that every themed token is defined exactly once for dark and once for light in index.css. That test replaces the syntax-only version of the same count check that was in syntaxHighlight.test.ts.

Validation

Handback validation passed on 55c731d7 with no fixes needed. It ran in headless Chromium against the real backend, at desktop (1280×720) and mobile (iPhone 13) sizes, and changed settings through Settings › General:

  • Dark mode: ring, card and popover tokens resolve, the focus ring on a Tab-focused button uses #d4d4d8 at 50%, and popover text uses popover-foreground.
  • Light mode: ring #6b7280, foregrounds #111827, gray focus ring, syntax-comment #6b7280.
  • Dracula palette: the new tokens are set inline from the palette, stay after a reload, and are cleared when switching back to Manager.
  • Font size: Small makes the root 14px and text-2xs 8.75px; Extra large makes the root 20px and text-2xs 12.5px; Default goes back to 16px. No text-[10px], text-[11px] or text-[15px] classes render.
  • No horizontal overflow and no console errors.
  • Design-system audit (Home, Session config; desktop and mobile) compared with main: no new findings, off-token findings dropped (for example 18 → 14 on Session config desktop), and 0 axe violations.
  • pnpm --filter frontend exec vitest run: 4132 tests passed. pnpm --filter frontend typecheck: clean. pnpm lint: 0 warnings and 0 errors. check_design: conforms.

Not rendered in the browser:

  • a markdown table on a phone (the padding rule was checked in the live stylesheet instead)
  • the Card component (its token value was checked in every mode)
  • the text-2xs call sites that need repositories, schedules or git data (covered by the diff and by checking that no pixel-size classes render anywhere in the DOM)

For the reviewer

  • Small visual shifts on purpose:
    • Labels that were 11px are now 10px (text-2xs).
    • Mobile FormPrompt descriptions and the RepoNavGroup repo name go from 15px to 14px (text-sm).
    • Mobile table cells lose 2px of vertical padding.
  • Shared neutrals: in dark mode muted and popover now share card's #141414, and accent and secondary now share border's #2a2a2a. Watch for places where a popover or muted surface sat on a card and depended on the slight difference to stand out.
  • Design changes waiting for merge: this task has pending design changes for DEC-29 and STYLE-3, 6, 22, 25, 33 and 35 in project.md. Apply them after merge.

PR Type

Enhancement


Description

  • Add missing ring, card-foreground and popover-foreground theme tokens

  • Derive those tokens for every OpenCode palette

  • Introduce text-2xs rem token and replace text-[10px]/text-[11px]

  • Consolidate near-duplicate neutrals and off-scale CSS literals


Diagram Walkthrough

flowchart LR
  A["Missing theme tokens"] -- "define ring and foregrounds" --> B["index.css dark and light"]
  B -- "register" --> C["colorTheme.ts MANAGER_THEME_TOKENS"]
  C -- "derive per palette" --> D["resolveColorThemeTokens and applyColorTheme"]
  E["Hardcoded px font sizes"] -- "replace with rem" --> F["text-2xs token"]
  F -- "apply" --> G["Component labels and badges"]
  H["Near-duplicate neutrals"] -- "merge" --> B
  I["Tests"] -- "assert tokens and occurrences" --> J["colorTheme.test.ts and syntaxHighlight.test.ts"]
Loading

File Walkthrough

Relevant files
Enhancement
2 files
index.css
Add theme tokens, text-2xs scale and merge neutrals           
+15/-8   
colorTheme.ts
Register and derive new theme tokens per palette                 
+6/-0     
Tests
2 files
colorTheme.test.ts
Test ring and foreground token derivation                               
+29/-0   
syntaxHighlight.test.ts
Remove duplicated occurrence-count helper from test           
+0/-5     
Formatting
16 files
SessionDetail.tsx
Use text-2xs for header metadata labels                                   
+3/-3     
PromptInput.tsx
Switch keybar and mode badge to text-2xs                                 
+2/-2     
SessionConfigMenu.tsx
Standardize config section and usage labels                           
+3/-3     
MessageThread.tsx
Use text-2xs for queued prompt status                                       
+1/-1     
ToolCallPart.tsx
Use text-2xs for sub-agent label                                                 
+1/-1     
VoiceConversationBar.tsx
Use text-2xs for voice notice text                                             
+1/-1     
ActivityCountPill.tsx
Use text-2xs for activity count pill                                         
+1/-1     
RepoSessionNav.tsx
Normalize nav title and branch text sizes                               
+2/-2     
WorktreeSessionGroups.tsx
Use text-2xs for worktree badges and paths                             
+3/-3     
ScheduleJobsTable.tsx
Use text-2xs for job pills                                                             
+2/-2     
ScheduleRunsTable.tsx
Use text-2xs for unread run badge                                               
+1/-1     
FormPrompt.tsx
Replace pixel description sizes with text-sm                         
+2/-2     
BranchesTab.tsx
Use text-2xs for branch state labels                                         
+2/-2     
GitFlatFileItem.tsx
Use text-2xs for staged badge                                                       
+1/-1     
TerminalPanel.tsx
Use text-2xs for terminal exit badge                                         
+1/-1     
PromptTab.tsx
Use text-2xs for template category badges                               
+2/-2     
Additional files
6 files
ContentDiffViewer.tsx +1/-1     
PromptSuggestions.tsx +1/-1     
ScheduleReportsBadge.tsx +1/-1     
MultiRunCard.tsx +1/-1     
WorktreeTabs.tsx +1/-1     
ChangesTab.tsx +1/-1     

@lil-worker-cstech

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⚠️ Risk checks: 9 finding(s) detected
Risky shapes (9): Table truncation in frontend/src/components/message/PromptInput.tsx, Table truncation in frontend/src/components/message/PromptInput.tsx, Table truncation in frontend/src/components/navigation/RepoSessionNav.tsx, Table truncation in frontend/src/components/navigation/RepoSessionNav.tsx, Table truncation in frontend/src/components/navigation/RepoSessionNav.tsx, Table truncation in frontend/src/components/navigation/RepoSessionNav.tsx, Table truncation in frontend/src/components/repo/WorktreeSessionGroups.tsx, Table truncation in frontend/src/components/repo/WorktreeSessionGroups.tsx, Removed JS/TS function in frontend/src/lib/theme/syntaxHighlight.test.ts
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
⚠️ Risk level: Low
✅ Merge recommendation: Needs review
Merge recommendation checks
✅ CI on reviewed head: passed
✅ Head is current with its base: up to date
✅ Human authors: all authors are human
⚠️ No sensitive paths or risky changes: 9 finding(s)
⚠️ Changed lines within cap: 131 changed lines exceeds cap 100
🔎 Failure modes

What: Small labels that used `text-[11px]` now use `text-2xs` (10px at the default root size). Badges and metadata text such as branch names, session config labels and worktree paths get slightly smaller and may become hard to read on dense mobile layouts.
Where: frontend/src/components/message/SessionConfigMenu.tsx:ConfigSection, frontend/src/pages/SessionDetail.tsx:SessionDetail
Trigger: The root font-size scaling is set to 87.5%, which renders `text-2xs` at about 8.75px.
Detected by: nothing; no visual regression test is apparent
Covered in this PR: No

What: Appearance snapshots saved before this change have no `ring`, `card-foreground` or `popover-foreground` entries. After a reload, the boot replay falls back to the static zinc or gray values until `applyColorTheme` runs, so focus rings briefly show the default colors instead of the palette colors.
Where: frontend/src/lib/theme/colorTheme.ts:applyColorTheme
Trigger: The first reload after upgrade with a non-default OpenCode palette selected.
Detected by: nothing; the change is transient and fixes itself once the theme is applied
Covered in this PR: No

What: The new token-parity test requires each themed token to appear exactly twice in `index.css`. A future override, such as a media query or a scoped block that redefines `--color-<key>:`, would fail this test even when the theme is correct.
Where: frontend/src/lib/theme/colorTheme.test.ts:defines every themed token once for dark mode and once for light mode
Trigger: A third `--color-<token>:` declaration is added anywhere in `index.css`.
Detected by: The test itself fails in CI.
Covered in this PR: Yes

🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected

@chriswritescode-dev
chriswritescode-dev merged commit d7131dd into main Dec 3, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant