feat(tui): add light color scheme with auto-detect and JSON config - #14
Open
dragonee wants to merge 1 commit into
Open
feat(tui): add light color scheme with auto-detect and JSON config#14dragonee wants to merge 1 commit into
dragonee wants to merge 1 commit into
Conversation
The TUI shipped a single hardcoded, dark-only "Blade Runner amber" theme
that was unreadable on light/white terminal backgrounds. Add a second,
light-optimized scheme while keeping the dark one byte-for-byte unchanged.
- Convert the col* palette to lipgloss.AdaptiveColor{Dark, Light}; Dark
keeps the original hex, Light is a warm palette tuned for white
backgrounds. Fold the duplicated inline #1a1305 into colOnAccent /
colSurface0 so badge text stays legible in both modes.
- Route the resolved dark/light flag (internal/tui/theme.go: SetTheme) to
the three subsystems that don't read the palette: glamour markdown
(dark/light standard style), chroma syntax highlighting (dark vs light
style list), and the spinner color.
- Resolve the scheme once at startup, before Bubble Tea takes the screen,
and freeze it with lipgloss.SetHasDarkBackground — the "auto" path
detects the terminal background there to avoid the AltScreen OSC-query
deadlock documented in markdown.go; dark is the fallback.
- Config: add PRCHECK_THEME (auto|dark|light, default auto) plus an
optional JSON config file at os.UserConfigDir()/prcheck/config.json,
parsed with stdlib encoding/json. Env overrides the file; a missing or
malformed file is non-fatal.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What & why
The TUI ships a single hardcoded, dark-only "Blade Runner amber" theme that is unreadable on light/white terminal backgrounds. This adds a second, light-optimized scheme while keeping the existing dark one byte-for-byte unchanged.
How
lipgloss.AdaptiveColor{Dark, Light}(internal/tui/view.go). TheDarkvariants are the original hex (dark output is identical to before); theLightvariants are a warm palette tuned for contrast on white. The duplicated inline#1a1305(9 sites) is folded intocolOnAccent/colSurface0so badge/tab text stays legible in both modes.internal/tui/theme.go(SetTheme): glamour markdown (dark/lightstandard style), chroma syntax highlighting (dark vs. light style list), and the spinner color.cmd/prcheck/main.go): the scheme is resolved once, before Bubble Tea enters AltScreen, and frozen withlipgloss.SetHasDarkBackground. Theautopath detects the terminal background there — sidestepping the AltScreen OSC-query deadlock documented inmarkdown.go— and falls back to dark when the terminal doesn't answer.internal/config): newPRCHECK_THEMEenv var (auto|dark|light, defaultauto) plus an optional JSON config file atos.UserConfigDir()/prcheck/config.json, parsed with stdlibencoding/json. Env overrides the file; a missing/malformed file is non-fatal.Notes
encoding/json; glamour/chroma/lipgloss already vendored).automeans existing users on dark terminals see no change.Testing
go build ./...,go vet ./...,gofmtclean.internal/config/file_test.go: file/env precedence, malformed-file tolerance, theme normalization.#ffb000, light renders#b25e00, toggled bySetHasDarkBackground.🤖 Generated with Claude Code