Skip to content

feat: add full-surface TUI theme pack#356

Open
Felictycf wants to merge 3 commits intojunhoyeo:mainfrom
Felictycf:feat/tui-theme-pack
Open

feat: add full-surface TUI theme pack#356
Felictycf wants to merge 3 commits intojunhoyeo:mainfrom
Felictycf:feat/tui-theme-pack

Conversation

@Felictycf
Copy link
Copy Markdown

@Felictycf Felictycf commented Mar 25, 2026

Summary

  • add gtuvbox, tokyo-night, catppuccin, solarized, gruvbox, and one-dark as first-class TUI themes
  • expand the original built-in themes so each one has its own surface/background palette instead of only changing the chart colors
  • respect persisted settings when --theme is omitted and repaint the Overview chart background correctly when switching themes
  • update the README theme documentation to match the shipped options

What Changed

  • introduced richer theme semantics in the TUI theme model so headers, tables, shortcuts, token columns, stripes, and selected states can all follow the active theme consistently
  • kept the original theme names and keyboard flow, while increasing the available TUI themes from 9 to 15
  • fixed the regression where the Tokens per Day section could keep the previous theme's background after a theme switch
  • documented the new theme list and configuration values in the README

Testing

  • cargo test -p tokscale-cli theme
  • cargo test -p tokscale-cli stacked_bar_chart_repaints_background_when_theme_changes
  • tokscale --theme purple

Notes

  • cargo test -p tokscale-cli still reports two unrelated pre-existing failures in tui::data cost assertions:
    • test_data_loader_loads_agent_usage_from_roocode_files
    • test_data_loader_keeps_synthetic_gateway_messages_under_original_client

Summary by cubic

Adds a full-surface TUI theme pack with six new themes and consistent colors across the UI. Also fixes stacked chart repainting/clearing and improves heatmap selection readability; the --theme flag now respects saved settings.

  • New Features

    • Added themes: gtuvbox, Tokyo Night, Catppuccin, Solarized, Gruvbox, One Dark (themes now 9 → 15).
    • Full-surface theming: backgrounds, headers, tables, stripes, selections, shortcuts, and token columns follow the active theme.
    • The --theme flag is optional; if omitted, the persisted setting is used (CLI value still overrides). Updated README and p now cycles through all 15.
  • Bug Fixes

    • Repaint and fully clear the Overview/Stats stacked chart area on theme switches, empty data, or chart shrink to avoid stale cells/glyphs.
    • Use contrast-aware text for selected contribution graph cells to keep highlights readable across themes.
    • Replace hardcoded UI colors with theme-provided success/info/warning and token colors for consistent visuals.

Written for commit eac2c76. Summary will update on new commits.

Add gtuvbox, Tokyo Night, Catppuccin, Solarized, Gruvbox, and One Dark as first-class TUI themes.

Preserve and expand the built-in themes with theme-specific surface colors, fix CLI/settings theme precedence, and repaint the overview chart background when switching themes.

Update the README theme documentation to match the shipped options.
@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 25, 2026

@Felictycf is attempting to deploy a commit to the Inevitable Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 13 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="crates/tokscale-cli/src/tui/ui/stats.rs">

<violation number="1" location="crates/tokscale-cli/src/tui/ui/stats.rs:146">
P2: Selected graph-cell highlight can become unreadable because theme foreground may not contrast with heatmap backgrounds.</violation>
</file>

<file name="crates/tokscale-cli/src/tui/ui/bar_chart.rs">

<violation number="1" location="crates/tokscale-cli/src/tui/ui/bar_chart.rs:54">
P2: The added background repaint runs only for non-empty data; empty-data early return still skips repaint, leaving stale chart area on theme/data transitions.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Keep the overview chart background in sync even when the chart data becomes empty.

Use contrast-aware foreground colors for selected contribution graph cells so the highlight stays readable across themes.
@Felictycf
Copy link
Copy Markdown
Author

Addressed the two cubic findings in follow-up commit 616b225:

  • repaint the Overview chart background even when the chart data is empty
  • switch selected contribution graph cells to a contrast-aware foreground color for better readability across themes

Re-ran:

  • cargo test -p tokscale-cli stacked_bar_chart_repaints_background_for_empty_data
  • cargo test -p tokscale-cli selection_foreground_uses_
  • cargo test -p tokscale-cli theme

@cubic-dev-ai please re-run review.

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai bot commented Mar 25, 2026

Addressed the two cubic findings in follow-up commit 616b225:

  • repaint the Overview chart background even when the chart data is empty
  • switch selected contribution graph cells to a contrast-aware foreground color for better readability across themes

Re-ran:
...

@Felictycf I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 13 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="crates/tokscale-cli/src/tui/ui/bar_chart.rs">

<violation number="1" location="crates/tokscale-cli/src/tui/ui/bar_chart.rs:50">
P2: Background repaint is bypassed in degenerate chart sizes because the early zero-dimension return happens before the new clear loop, allowing stale themed cells during compressed layouts.</violation>

<violation number="2" location="crates/tokscale-cli/src/tui/ui/bar_chart.rs:52">
P2: Empty-data repaint path updates only style and can leave stale chart glyphs in the buffer.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

@junhoyeo junhoyeo force-pushed the main branch 2 times, most recently from 63e6d84 to bef1da8 Compare March 25, 2026 22:13
@Felictycf
Copy link
Copy Markdown
Author

Addressed the remaining bar_chart.rs review points in eac2c76.

What changed:

  • clear the full chart area before any early return so theme switches still repaint degenerate chart sizes
  • clear each cell to a space while applying the background so stale glyphs cannot survive the empty-data path

Re-ran:

  • cargo test -p tokscale-cli stacked_bar_chart_repaints_background_for_degenerate_chart_area -- --nocapture
  • cargo test -p tokscale-cli stacked_bar_chart_clears_existing_glyphs_for_empty_data -- --nocapture
  • cargo test -p tokscale-cli stacked_bar_chart -- --nocapture
  • cargo test -p tokscale-cli theme -- --nocapture

@cubic-dev-ai please re-run review.

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai bot commented Mar 29, 2026

Addressed the remaining bar_chart.rs review points in eac2c76.

What changed:

  • clear the full chart area before any early return so theme switches still repaint degenerate chart sizes
  • clear each cell to a space while applying the background so stale glyphs cannot survive the empty-data path
    ...

@Felictycf I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 13 files

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.

1 participant