Skip to content

Feature/base16 themes#19

Merged
SpollaL merged 20 commits into
mainfrom
feature/base16-themes
May 6, 2026
Merged

Feature/base16 themes#19
SpollaL merged 20 commits into
mainfrom
feature/base16-themes

Conversation

@SpollaL
Copy link
Copy Markdown
Owner

@SpollaL SpollaL commented May 6, 2026

Summary

Replaces the hardcoded Catppuccin Mocha palette with a full Base16 theme system, adding live theme switching via an in-TUI picker and multiple built-in schemes.

What's new

  • 9 built-in Base16 schemes: Catppuccin Mocha (default), Latte, Frappé, Macchiato, Gruvbox Dark, Nord, Dracula, Solarized Dark, Tokyo Night
  • --theme <name> CLI flag — select a theme at startup
  • DATASIGHT_THEME env var — override the theme without touching the command line
  • State persistence — last-used theme is saved to ~/.config/datasight/state.toml and restored on next launch
  • Live theme picker (t key) — popup overlay with arrow-key navigation and immediate live preview; works in both normal viewer and browse mode
  • Semantic Theme struct — all UI colours are resolved from named slots (bg, bg_alt, accent, error, series[6], …); no hardcoded palette references remain in ui.rs or browser/ui.rs

Precedence

--theme flag  >  DATASIGHT_THEME  >  state.toml  >  mocha (default)

Files added

File Purpose
src/theme.rs Base16 schemes, semantic Theme struct, state I/O, resolve_theme
src/theme_picker.rs ThemePicker state + render_picker() popup, shared by both app modes

Breaking changes

None — the default theme (Mocha) is visually identical to the previous hardcoded palette. The catppuccin crate dependency has been removed.

SpollaL and others added 16 commits May 6, 2026 21:56
Adds Base16Scheme + Theme structs, Theme::from_scheme slot mapping,
and MOCHA constant. New deps: dirs, serde, toml; tempfile dev-dep.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
… Nord, Dracula, Solarized, Tokyo Night)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…dence

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…slots

Add `theme: &'static Theme` to App, plumb the resolved theme from main.rs
through App::new, and replace ~140 hardcoded `c(m.<color>)` Catppuccin Mocha
references in src/ui.rs and src/browser/ui.rs with semantic Theme slots
(`theme.bg`, `theme.accent`, `theme.error`, `theme.series[N]`, …) per the
Base16 mapping table. BrowserApp uses default_theme() as a Task 8 placeholder.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add `theme: &'static Theme` to BrowserApp, propagate from main.rs and into
the embedded viewer when a file is opened. browser_ui now reads `app.theme`
instead of the temporary `default_theme()` placeholder.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All theme colors now come from the in-repo Base16 schemes in src/theme.rs;
the Catppuccin Mocha palette is one of nine built-in schemes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ThemePicker holds a cursor into list_themes() and remembers the original
theme name so Esc can revert. render_picker draws a centered popup with
the theme list, current selection highlight, and a key-hint footer.

Wired into App in Task 11 — module-level #![allow(dead_code)] is removed
there.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
T opens the picker; j/k navigate with live preview (App.theme reassigned
on each move); Enter persists the choice to ~/.config/datasight/state.toml
and exits; Esc reverts to the original theme. Mode::ThemePicker is added
with PartialEq so the matches! → == switch in ui.rs reads naturally.

Drops the temporary `#[allow(dead_code)]` on display_name,
write_state_theme_at, and the theme_picker module — all wired in now.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
T (uppercase) opens the picker globally; the handler runs before the
ctrl-e and Tab interceptors so the picker takes precedence. j/k previews
update both BrowserApp.theme and the embedded viewer.theme so both panes
re-render in the new theme. Enter persists; Esc reverts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a Suite Y that opens the picker with T, verifies the popup is
visible and cancellable with Esc, then re-opens, navigates with j,
and persists with Enter — checking ~/.config/datasight/state.toml
ends up with a theme= entry. Covers both the file-viewer and browse
entry points. Cleans up the state file at the end.

The block also resets cwd to REPO_ROOT first, since X6 leaves the
shell in tests/fixtures.
Updates README with a Themes section, the T keybind, a Base16-themed
Features bullet, and refreshed tagline. CLAUDE.md gets entries for
theme.rs and theme_picker.rs, the new ThemePicker mode variant, and
a note on how browse mode keeps the viewer's theme in sync.
@SpollaL SpollaL force-pushed the feature/base16-themes branch from b4e7790 to 9b3ac89 Compare May 6, 2026 19:57
SpollaL and others added 4 commits May 6, 2026 22:07
- Fix help_text: p entered pick-Y not pick-X; add Space entry; clarify
  Enter behaviour per mode; expand t to mention histogram for single-Y
- Add Theme section to help popup (T, j/k, Enter, Esc)
- README: add missing `i` (row-index X) to Plot table
- README: add missing `T` (theme picker) to Browse keybindings table

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
"Use row index as X" didn't convey that i skips X selection and plots
immediately. Renamed to "Plot now (row index as X)" and updated "Pick X"
to "Pick X axis" for symmetry.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The i key was only visible in the shortcut badge row and could be cut
off on narrow terminals. Added it to the bold info bar where users look
first, and shortened the badge label to "Plot with index".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@SpollaL SpollaL merged commit 2604992 into main May 6, 2026
11 of 12 checks passed
@SpollaL SpollaL deleted the feature/base16-themes branch May 6, 2026 20:34
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