Document dark-mode color token rule in AGENTS.md - #3748
Merged
Conversation
Require --color-frame-* tokens (dark-mode aware) over --wpds-color-* for renderer CSS, and verify UI in both light and dark schemes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
youknowriad
reviewed
Jun 11, 2026
|
|
||
| **Files**: React components (PascalCase), utils (camelCase), tests (.test.ts/.tsx) | ||
| **Class names (`cx`)**: Use `cx()` (`apps/studio/src/lib/cx.ts`) only to join classes with conditions (e.g. `cx( 'base', isActive && 'active' )`). For a single static string, pass the bare string instead of wrapping it — `className="h-full"`, not `className={ cx( 'h-full' ) }`. Enforced (and auto-fixed) by the `studio/no-redundant-cx` ESLint rule (`tools/eslint-plugin-studio`). | ||
| **Theming / colors (renderer CSS)**: Studio supports light + dark via `@media (prefers-color-scheme: dark)`. For any **color** (text, background, border, fill, brand/theme, error/running states) **MUST** use Studio's dark-aware `--color-frame-*` tokens defined in `apps/studio/src/index.css` (e.g. `--color-frame-text`, `--color-frame-bg`, `--color-frame-surface`, `--color-frame-border`, `--color-frame-theme`, `--color-frame-error`). **NEVER** use `--wpds-color-*` tokens for color — they ship light-only fallbacks from `@wordpress/ui` and render broken (invisible text, wrong borders) in dark mode. Non-color `--wpds-*` tokens (`--wpds-dimension-*`, `--wpds-typography-*`, `--wpds-border-width-*`, `--wpds-elevation-*`, `--wpds-cursor-*`) are theme-independent and fine to use. When a needed color has no `--color-frame-*` token, add one (with both light and dark values) rather than reaching for `--wpds-color-*`. |
Contributor
There was a problem hiding this comment.
Just nothing that this not true for all of studio and more precisely apps/ui. apps/ui uses a ThemeProvider for dark/light mode around the whole canvas which means we should do the opposite actually, always use --wpds variables because they adapt to the active theme.
Contributor
There was a problem hiding this comment.
Maybe we should update this to specify that each "app" has its own dark mode rules as it doesn't feel worth our time to refactor apps/studio to use ThemeProvider as there's a chance that we'll replace it entirely.
1 task
sejas
added a commit
that referenced
this pull request
Jun 12, 2026
- #3748 documented a blanket rule — always use `--color-frame-*`, never `--wpds-color-*` — but that only holds for `apps/studio`. In `apps/ui` the whole canvas is wrapped in a `ThemeProvider`, so `--wpds` variables adapt to the active theme and are exactly what should be used there (the agentic UI already uses them exclusively). - This updates AGENTS.md so each app carries its own dark-mode rules, preventing agents and contributors from applying the `apps/studio`-only token guidance inside `apps/ui` (or vice versa). It also notes there's no plan to refactor `apps/studio` onto `ThemeProvider`, since it may be replaced entirely.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related issues
How AI was used in this PR
Claude Code analyzed the #3744 dark-theme fix, identified the root cause (renderer components used light-only
--wpds-color-*tokens), and drafted the documentation guardrails. I reviewed the wording and scope myself before committing.Proposed Changes
The Studio Code session UI shipped broken in dark mode because its CSS used
--wpds-color-*tokens from@wordpress/ui, which carry hardcoded light fallbacks and don't respond toprefers-color-scheme: dark. Components looked correct in light mode, so the regression slipped through.This documents the rule so contributors (and AI agents) don't reintroduce it:
--color-frame-*tokens for all colors;--wpds-color-*color tokens are banned. Non-color--wpds-*tokens (dimension, typography, border-width, elevation, cursor) remain fine.Docs-only change — no runtime impact.
Testing Instructions
AGENTS.md: confirm the new "Theming / colors (renderer CSS)" rule under Conventions, the dark-mode note in Post-Change Verification, and the "Dark Mode Color Tokens" entry under Common Pitfalls.Pre-merge Checklist