Add customizable TUI color themes - #190
Open
byt3m4st3r wants to merge 11 commits into
Open
byt3m4st3r wants to merge 11 commits into
byt3m4st3r wants to merge 11 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add customizable TUI color themes
Bundled presets with their theme inventor credits (see README):
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 dark, based on Cyberdream

Rose Pine Dawn (light)

Rose Pine (dark)

Changelog
CHANGELOG.mdunder[Unreleased], or this PR does not need oneTests