Skip to content

feat: add full-surface TUI theme pack#356

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

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

Conversation

@Felictycf
Copy link

@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 theming across the UI. Also fixes chart background repainting (including empty-data cases) and improves selection readability in the Stats heatmap; 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 now follow the active theme.
    • The --theme flag is optional; if omitted, the persisted setting is used. CLI value still overrides settings.
    • Updated README to document 15 themes and valid colorPalette values; “p” now cycles through all 15.
  • Bug Fixes

    • Repaint the Overview/Stats chart background on theme switches and when data becomes empty to avoid stale cells.
    • 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 616b225. 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
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
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
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
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
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.

let buf = frame.buffer_mut();
let bar_count = data.len();

for y in area.y..(area.y + area.height) {
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 25, 2026

Choose a reason for hiding this comment

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

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.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At crates/tokscale-cli/src/tui/ui/bar_chart.rs, line 50:

<comment>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.</comment>

<file context>
@@ -51,6 +47,16 @@ pub fn render_stacked_bar_chart(frame: &mut Frame, app: &App, area: Rect, data:
     let buf = frame.buffer_mut();
     let bar_count = data.len();
 
+    for y in area.y..(area.y + area.height) {
+        for x in area.x..(area.x + area.width) {
+            buf[(x, y)].set_style(Style::default().bg(app.theme.background));
</file context>
Fix with Cubic


for y in area.y..(area.y + area.height) {
for x in area.x..(area.x + area.width) {
buf[(x, y)].set_style(Style::default().bg(app.theme.background));
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 25, 2026

Choose a reason for hiding this comment

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

P2: Empty-data repaint path updates only style and can leave stale chart glyphs in the buffer.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At crates/tokscale-cli/src/tui/ui/bar_chart.rs, line 52:

<comment>Empty-data repaint path updates only style and can leave stale chart glyphs in the buffer.</comment>

<file context>
@@ -51,6 +47,16 @@ pub fn render_stacked_bar_chart(frame: &mut Frame, app: &App, area: Rect, data:
 
+    for y in area.y..(area.y + area.height) {
+        for x in area.x..(area.x + area.width) {
+            buf[(x, y)].set_style(Style::default().bg(app.theme.background));
+        }
+    }
</file context>
Suggested change
buf[(x, y)].set_style(Style::default().bg(app.theme.background));
buf[(x, y)]
.set_char(' ')
.set_style(Style::default().bg(app.theme.background));
Fix with Cubic

@junhoyeo junhoyeo force-pushed the main branch 2 times, most recently from 63e6d84 to bef1da8 Compare March 25, 2026 22:13
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