Repository navigation
Theme system v2: custom palettes, colorblind presets, and monochrome - #72
Merged
Merged
Conversation
Generalize the theme system so users can define custom palettes in ~/.mayros/themes/*.json. Each file must contain the 22 palette color tokens as #RRGGBB hex strings; the loader validates, caches by mtime, and registers them so /theme <name> and config.ui.theme accept custom names alongside the built-ins. Add three new built-in palettes: - colorblind-dark and colorblind-light: Okabe-Ito hues that avoid the red/green pairing for error/success (error = vermilion, success = sky blue), so deuteranopic and protanopic users get distinguishable semantic colors. - monochrome: all tokens use the same foreground, for NO_COLOR environments or users who prefer a minimal terminal. Generalize ThemePreset from a closed union to string (with BuiltinPreset for the 13 built-ins), add a custom palette registry, and relax the /theme handler and config guards to accept custom names. The loader runs at TUI startup before the config theme is resolved.
Remove the duplicated THEME_PRESETS array from commands.ts (it was a
local copy that had already drifted — missing the three new palettes
added in the theme system update). Import the canonical list from
palettes.ts instead so there is a single source of truth.
Migrate the three process.stderr.write call sites in
tui-command-handlers.ts (fast-mode) and compact-handler.ts to the
shared subsystem logger (createSubsystemLogger("tui")), so TUI
diagnostics route through the same logging infrastructure as the rest
of the codebase instead of writing raw stderr.
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.
Summary
Generalizes the TUI theme system so users can define custom palettes, adds colorblind-optimized presets, and cleans up duplicated configuration.
Custom themes
*.jsonfiles in~/.mayros/themes/to define custom palettes. Each file must contain the 22 palette color tokens as#RRGGBBhex strings. The loader (theme-loader.ts) validates, caches by mtime, and registers them at startup so/theme <name>andconfig.ui.themeaccept custom names alongside built-ins.ThemePresetgeneralized from a closed union tostring(withBuiltinPresetfor the 13 built-ins).resolvePaletteconsults a custom registry after the builtin switch.New built-in palettes
colorblind-darkandcolorblind-light: Okabe-Ito hues that avoid the red/green pairing for error/success (error = vermilion#D55E00, success = sky blue#56B4E9), so deuteranopic and protanopic users get distinguishable semantic colors.monochrome: all tokens use the same foreground, forNO_COLORenvironments or minimal terminals.Polish
THEME_PRESETSarray —commands.tshad a local copy that had already drifted (missing the three new palettes). Now imports the canonical list frompalettes.ts.process.stderr.writecall sites (fast-mode, compact-handler) to the shared subsystem logger (createSubsystemLogger("tui")).Test plan
pnpm tsgo— 0 errorspnpm lint— 0 errors, 352 warningspnpm exec vitest run src/tui/— 512 passed, 1 skipped, 0 failed