feat(theme): add system theme that reads terminal color palette#31
feat(theme): add system theme that reads terminal color palette#31simonayotte wants to merge 1 commit intoremorses:mainfrom
Conversation
Adds a "system" theme option that queries the terminal's configured ANSI color palette via OSC 4/10/11 and maps those colors to critique's theme roles (error→red, success→green, primary→cyan, etc.). Background is set to transparent so the terminal's native background shows through. Falls back to github theme if OSC queries are unsupported. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ad253cdb09
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| export const themeNames = Object.keys(THEME_FILES).sort(); | ||
| export const themeNames = ["system", ...Object.keys(THEME_FILES)].sort(); |
There was a problem hiding this comment.
Hydrate system palette before advertising the system theme
Adding system to the global themeNames list makes it selectable in render paths that never populate cachedSystemTheme (for example, the review TUI path in runReviewMode/ReviewApp does not call renderer.getPalette + setSystemTheme). In those contexts, selecting system always resolves to the fallback github theme via getResolvedTheme("system"), so users get a misleading non-system theme. Either initialize the palette in those flows or avoid exposing system there.
Useful? React with 👍 / 👎.
|
@remorses Have you had the chance to take a look at this? :) Thanks! |
CleanShot.2026-02-19.at.16.29.40.mp4
Summary
systemtheme that detects the terminal's configured color palette via OSC queries and maps those colors to critique's theme rolesgithubtheme if the terminal doesn't support OSC queriesHow it works
system,renderer.getPalette()is called before the first render so the initial frame already uses terminal colorssystemat runtime (via the theme picker), palette detection runs again and triggers a re-renderChanges
themes.ts—resolveSystemTheme(),setSystemTheme(),TerminalPaletteinterface,systemadded tothemeNamescli.tsx— palette detection before first render + runtime re-detection when switching to system theme🤖 Generated with Claude Code