Skip to content

feat(theme): add system theme that reads terminal color palette - #31

Open
simonayotte wants to merge 1 commit into
remorses:mainfrom
simonayotte:feat/system-theme
Open

simonayotte wants to merge 1 commit into
remorses:mainfrom
simonayotte:feat/system-theme

Conversation

@simonayotte

@simonayotte simonayotte commented Feb 19, 2026 •

Copy link
Copy Markdown
CleanShot.2026-02-19.at.16.29.40.mp4

Summary

  • Adds a new system theme that detects the terminal's configured color palette via OSC queries and maps those colors to critique's theme roles
  • Background is set to fully transparent so the terminal's native background (including transparency/blur effects) shows through
  • Falls back to github theme if the terminal doesn't support OSC queries

How it works

  1. At startup, if the saved theme is system, renderer.getPalette() is called before the first render so the initial frame already uses terminal colors
  2. When the user switches to system at runtime (via the theme picker), palette detection runs again and triggers a re-render
  3. Color mapping:
    • ANSI slot 1 (red) → error, diff removed
    • ANSI slot 2 (green) → success, diff added, syntax strings
    • ANSI slot 3 (yellow) → warning, syntax numbers
    • ANSI slot 4 (blue) → links, syntax functions
    • ANSI slot 5 (magenta) → syntax keywords
    • ANSI slot 6 (cyan) → primary, info, syntax types
    • Bright variants (slots 8–15) preferred for syntax colors
    • Foreground → text, syntax variables
    • Background → transparent

Changes

  • themes.ts — resolveSystemTheme(), setSystemTheme(), TerminalPalette interface, system added to themeNames
  • cli.tsx — palette detection before first render + runtime re-detection when switching to system theme

🤖 Generated with Claude Code

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>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread src/themes.ts
}

export const themeNames = Object.keys(THEME_FILES).sort();
export const themeNames = ["system", ...Object.keys(THEME_FILES)].sort();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@simonayotte

simonayotte commented Feb 24, 2026 •

Copy link
Copy Markdown
Author

@remorses Have you had the chance to take a look at this? :) Thanks!

@realfizz

realfizz commented Apr 26, 2026 •

Copy link
Copy Markdown

👀 👀 👀

thank you sm, I was just about to create a PR for this!

Sign up for free to 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.

2 participants