feat(tui): new theme + Catppuccin syntax highlighter - #88
Conversation
d858908 to
e690065
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Refresh the TUI theme and adopt a Catppuccin code-syntax highlighter: - Accent reharmonized to the brand periwinkle/indigo (#B3B9F4 dark / #0B114E light); border_accent and the selection tint follow the accent family (the selection bg is now sourced from a single constant feeding both the token and the prompt-toolkit styles). - Code blocks use Catppuccin Mocha (dark UI) / Latte (light UI), adaptive, hand-built as Pygments styles and rendered foreground-only on the calm code-block panel (transparent bg). 'pythinker-ansi' and stock Pygments styles remain opt-ins; the config default is now 'catppuccin-adaptive'. - Markdown uses terminal-native ANSI for inline code and links (cyan), blockquotes (green) and ordered-list markers (bright blue), mode-independent. Also fixes the vendored renderer that stripped blockquote colour and left list markers unstyled. - User-sent messages render on a neutral grey block (#333333 / #E0E0E0), removing the prior blue tint. Shimmer ramp constants now derive from the activity tokens and the unused tool_success_bg token is removed.
e690065 to
cde81bd
Compare
The CI `check` job failed pyright on tests/ui_and_conv/test_tui_theme_tokens.py: type the `expected` dict keys as ThemeName so the loop var is accepted by get_tui_tokens, and route markdown_rich_style(...).color.name through a _color_name helper that asserts the optional Color is present. Also add the missing `## Unreleased` CHANGELOG bullet for the new TUI theme + Catppuccin highlighter, fixing the `changelog` job.
📝 WalkthroughWalkthroughThis PR replaces the ANSI code-theme default with Catppuccin adaptive (switching dark/light with UI theme), unifies selection backgrounds via shared constants, harmonizes markdown to terminal-native ANSI colors (cyan/green/bright_blue), and restructures UI tokens accordingly. All rendering paths and tests are updated to reflect the new theme system. ChangesCatppuccin theme migration and markdown color harmonization
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes The PR involves dense logic across multiple theme system layers (syntax theme definitions, token restructuring, markdown color mappings, rendering branching logic), heterogeneous changes to shell components and utilities, and comprehensive test coverage updates that require understanding the new ANSI-color-based approach and adaptive theme switching. Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
tests/ui_and_conv/test_code_theme_opt_in.py (1)
1-7:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winUpdate the module docstring to reflect the new default theme.
The docstring still says the default is
pythinker-ansi, but this file now validatescatppuccin-adaptiveas default, which is misleading for future maintainers.Suggested edit
-Default (``pythinker-ansi``) keeps today's terminal-adaptive, transparent look. +Default (``catppuccin-adaptive``) follows active UI theme (Mocha/Latte) while +preserving transparent syntax backgrounds in fenced code blocks.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/ui_and_conv/test_code_theme_opt_in.py` around lines 1 - 7, The module docstring in tests/ui_and_conv/test_code_theme_opt_in.py incorrectly states the default theme as "pythinker-ansi"; update that top-level docstring to say the current default is "catppuccin-adaptive" (and adjust the explanatory text accordingly) so it matches the test's expectations and avoids future confusion about the default code_theme.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/ui_and_conv/test_tui_theme_tokens.py`:
- Around line 93-102: The test imports private theme dicts
(_PROMPT_STYLE_DARK/_PROMPT_STYLE_LIGHT) which couples it to implementation;
instead remove those imports and assert the selection background via the public
API: use get_tui_tokens("dark"/"light") to get selected_bg and call the public
style-rendering function that returns the prompt style mapping for the theme
(the same mapping that would contain "slash-completion-menu.row.current") and
assert that mapping["slash-completion-menu.row.current"] ==
f"bg:{get_tui_tokens('dark' or 'light').selected_bg}"; replace references to
_PROMPT_STYLE_DARK/_PROMPT_STYLE_LIGHT with this public-style call and keep the
existing key "slash-completion-menu.row.current".
---
Outside diff comments:
In `@tests/ui_and_conv/test_code_theme_opt_in.py`:
- Around line 1-7: The module docstring in
tests/ui_and_conv/test_code_theme_opt_in.py incorrectly states the default theme
as "pythinker-ansi"; update that top-level docstring to say the current default
is "catppuccin-adaptive" (and adjust the explanatory text accordingly) so it
matches the test's expectations and avoids future confusion about the default
code_theme.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: f0bd414e-4b09-4d41-a792-16500f62f7f9
📒 Files selected for processing (14)
CHANGELOG.mdsrc/pythinker_code/config.pysrc/pythinker_code/ui/shell/__init__.pysrc/pythinker_code/ui/shell/components/markdown.pysrc/pythinker_code/ui/shell/motion.pysrc/pythinker_code/ui/theme.pysrc/pythinker_code/utils/rich/markdown.pysrc/pythinker_code/utils/rich/syntax.pytests/core/test_config.pytests/ui_and_conv/test_code_theme_opt_in.pytests/ui_and_conv/test_md_color_contract.pytests/ui_and_conv/test_shell_design_system.pytests/ui_and_conv/test_shell_panel.pytests/ui_and_conv/test_tui_theme_tokens.py
Refreshes the TUI theme and adopts a Catppuccin code-syntax highlighter, with the brand accent preserved.
What changed
Accent (brand periwinkle/indigo)
accent→#B3B9F4(dark) /#0B114E(light);border_accent+ the selection tint reharmonized into the same family._SELECTED_BG_*) feeding both theselected_bgtoken and the prompt-toolkit completion/dialog styles — no more parallel literals.Catppuccin syntax highlighter
background_color="default"), keeping the no-background-on-markdown invariant.pythinker-ansiand stock Pygments styles remain opt-ins; the config default is nowcatppuccin-adaptive.Markdown (terminal-native ANSI, mode-independent)
cyan, blockquotes →green, ordered-list markers →bright_blue(terminal-native ANSI, so they adapt per terminal).User messages
#333333/#E0E0E0), removing the prior blue "blur" tint.Cleanup
activity_verb*tokens (kill drift); dead_SPINNER_SILVERand unusedtool_success_bgtoken removed.Verification
mainbase).Notes
tool_diff_added≡success,activity_label≡tool_title, …), the fixed brand-logo palette, and the wired-but-empty*_message_texttokens were intentionally kept (documented) — merging/removing them would reduce semantic clarity.Summary by CodeRabbit
New Features
Style