Skip to content

Feat/theme preview - #83

Merged
JoseVelazcoH merged 8 commits into
JoseVelazcoH:developfrom
raydroplet:feat/theme-preview
Jul 9, 2026
Merged

JoseVelazcoH merged 8 commits into
JoseVelazcoH:developfrom
raydroplet:feat/theme-preview

Conversation

@raydroplet

@raydroplet raydroplet commented Jul 7, 2026 •

Copy link
Copy Markdown

Summary

Colored theme preview with tth theme preview <name>

Motivation

Closes #80

Changes

  • Improve clap argument definitions to support new features
  • Bump ratatui and crossterm version to get access to color.into_crossterm()
  • handle theme preview with colored output in preview_theme_colors()

Test plan

The changes are small and may not require additional tests

Review checklist

  • tth theme preview <name> prints every semantic slot with a colored swatch and its value.
  • Works for built-in themes and user themes in the themes dir.
  • Unknown theme name errors clearly.
  • Honors NO_COLOR (no ANSI when disabled).
  • A test asserts the preview lists all slots for a known built-in.

Breaking changes

None

@raydroplet

Copy link
Copy Markdown
Author

As of now only the colored squares of each theme entry are displayed. I found that displaying the color as a text value does not provide much additional value to the end user, but it can be trivially added in one of the println calls.

I'm not sure what "A test asserts the preview lists all slots for a known built-in." means. All printed values are taken from the Theme struct returned by crate::config::resolve_theme (an internal function), so it doesn't seem any fields are missing.

@JoseVelazcoH

Copy link
Copy Markdown
Owner

Thanks! I Tested locally and the swatches work great. A few things before merging:

  1. Print the hex value next to each swatch (selection_bg ██ #44475a). The reason is that it lets people compare exact colors.

  2. NO_COLOR shows the wrong theme name: NO_COLOR=1 tth theme preview dracula prints Theme: rosepine (my current theme) instead of dracula. That branch uses cfg.theme.name but should use a.name.

  3. The test: just run the preview for a built-in and assert all 13 slot labels show up

@JoseVelazcoH JoseVelazcoH added type: feature New feature or request good-first-issue Good for newcomers labels Jul 7, 2026
raydroplet and others added 2 commits July 7, 2026 17:39
The background color was reset in the same println, so it never painted.
The swatch renders from the foreground color alone. Also drop the leftover
example comment block.
@JoseVelazcoH

Copy link
Copy Markdown
Owner

Two small changes were made on top of your work to keep the preview clean:

  1. Removed the SetBackgroundColor call in print_color_line. It was reset in the same println, so it never actually painted a background. The swatch already renders correctly from the foreground color alone
  2. Removed the leftover example comment block at the end of the function.

Everything else looks great. Thanks a lot for tackling this and for this contribution! 🙌

@JoseVelazcoH
JoseVelazcoH changed the base branch from main to develop July 9, 2026 20:51
@JoseVelazcoH
JoseVelazcoH merged commit daa95ee into JoseVelazcoH:develop Jul 9, 2026
5 checks passed
@raydroplet
raydroplet deleted the feat/theme-preview branch July 10, 2026 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

good-first-issue Good for newcomers type: feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(theme): preview a theme's colors

2 participants