Skip to content

Add customizable TUI color themes - #190

Open
byt3m4st3r wants to merge 11 commits into
emanuele-em:mainfrom
byt3m4st3r:feat/theme-tui
Open

byt3m4st3r wants to merge 11 commits into
emanuele-em:mainfrom
byt3m4st3r:feat/theme-tui

Conversation

@byt3m4st3r

Copy link
Copy Markdown
Contributor

Add customizable TUI color themes

Bundled presets with their theme inventor credits (see README):

  • Cyberdream
  • Cyberdream Light
  • Cyberdream Muted
  • Rose Pine
  • Rose Pine Dawn
  • Tokyo Night
  • Tokyo Night Day
  • Dracula
  • Alucard
  • Catppuccin Mocha
  • Catppuccin Latte

Support system light/dark theme selection and custom TOML themes.

Support per-color overrides through config.toml.

Add theme-aware JSON body highlighting.

Preserve the existing default ANSI palette.

Document custom theme configuration.

Serialize appearance-detection tests to prevent COLORFGBG races.

Should be merged after #177.

Showcase

Default light, based on Cyberdream
default_light

Default dark, based on Cyberdream
default_dark

Rose Pine Dawn (light)
new_light

Rose Pine (dark)
new_dark

Changelog

  • I have added an entry to CHANGELOG.md under [Unreleased], or this PR does not need one

Tests

  • I have added or updated tests for user-visible behavior changes, or this PR does not need tests

Every hardcoded ANSI color in the TUI is now theme-driven. Theme::default()
reproduces the original palette exactly, so this is a no-op until a user
opts into something else.

- --theme flag / config.toml `theme` key: default/dark/light (adapt to the
  terminal's own palette), system (auto-detect, see theme_dark/theme_light),
  a bundled name (cyberdream, cyberdream-light), or ~/.proxelar/themes/<name>.toml
- Partial themes: a custom theme file only needs to override what it changes
- [colors] table in config.toml for one-off overrides with no theme file
- Bad theme names / unknown keys / invalid colors warn and fall back rather
  than failing to start

Not dependent on $XDG_CONFIG_HOME support (separate branch); resolves
~/.proxelar directly. Config/theme resolution is placed away from the
top-of-main ca_dir assignment so this merges without conflicts alongside
that branch's changes to the same file.
Eight new bundled themes (each with a dark/light pair), ported from their
official color specs:
- rose-pine / rose-pine-dawn
- tokyonight / tokyonight-day
- dracula / alucard
- catppuccin-mocha / catppuccin-latte

Also adds a README credits section linking each theme's upstream project.
Uses the Muted palette variant (desaturated accents on the same dark
background) alongside the existing cyberdream/cyberdream-light pair.
Adds a themes/ folder walkthrough to the Theming section: a partial-override
example, and all three config.toml combinations (dark only, light only, or
both via theme = "system" + theme_dark/theme_light). Points to
known_theme_keys() in theme.rs, and the bundled theme presets themselves,
as references for the full list of colorable keys.
Guard COLORFGBG reads/writes in the four appearance-detection tests
with a shared mutex so parallel test execution cannot race on the
process-wide environment variable. The guard restores the previous
value (or unset state) on drop, including during panic unwinding, and
tolerates a poisoned lock.

Correct README instructions to match actual theme resolution:
CA_DIR/config.toml and CA_DIR/themes/<name>.toml (CA_DIR defaults to
~/.proxelar), name-based --theme selection without a path or .toml
suffix, and startup-only system appearance detection. Remove the
unsupported automatic XDG_CONFIG_HOME lookup claim.

No production behavior changes.
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