feat(functions): derive the shared help palette from the fish theme #159

Merged
rootiest merged 5 commits from feat/theme-driven-help-palette into main 2026-09-21 05:53:22 +00:00
Owner

Summary

  • __fish_palette's c_cmd/c_flag/c_arg/c_dim now read fish's own highlighter variables (fish_color_command/option/param/autosuggestion) when set, and c_head reads the pager's fish_pager_color_prefix, so --help text matches whatever the user's actual theme renders at the prompt instead of a fixed guess at it. Each role keeps its previous static value as a fallback (e.g. a --no-config script, or the theme variable being unset or empty).
  • Routes __fish_help_header's title/section colors and config-help's, gi's, and git-clean's own hand-rolled --help blocks through the palette instead of their hardcoded set_color calls, which fixes the --help-vs-actual-prompt color mismatch across most of the config's functions in one place (__fish_help_header backs the majority of user-facing --help output).
  • Also fixes role mismatches found along the way: several already-palette functions (dockup, fish-deps, pkg, play-media, dng2avif) were coloring their <placeholder>/[bracket] argument text with c_dim instead of c_arg, and scrub's "Aggressive Targets:" heading was still a hardcoded set_color call sitting next to an otherwise-converted help block.

Test plan

  • fish -n on every changed file
  • python3 docs/verify-manual.py (84/84)
  • fish tests/run-tests.fish (758/758 assertions, including the palette-role and colored-help-output checks, and the 250-file indent lint)
  • Manually rendered --help for gi, git-clean, scrub, dockup, fish-deps, pkg, play-media, and config-help in an interactive Catppuccin Mocha shell — confirmed theme-correct colors (command=blue, flag=green, arg=flamingo/pink, heading=bold mauve) and no runtime errors
  • Confirmed the static fallback path still renders under --no-config (no theme variables set)
## Summary - `__fish_palette`'s `c_cmd`/`c_flag`/`c_arg`/`c_dim` now read fish's own highlighter variables (`fish_color_command`/`option`/`param`/`autosuggestion`) when set, and `c_head` reads the pager's `fish_pager_color_prefix`, so `--help` text matches whatever the user's actual theme renders at the prompt instead of a fixed guess at it. Each role keeps its previous static value as a fallback (e.g. a `--no-config` script, or the theme variable being unset or empty). - Routes `__fish_help_header`'s title/section colors and `config-help`'s, `gi`'s, and `git-clean`'s own hand-rolled `--help` blocks through the palette instead of their hardcoded `set_color` calls, which fixes the `--help`-vs-actual-prompt color mismatch across most of the config's functions in one place (`__fish_help_header` backs the majority of user-facing `--help` output). - Also fixes role mismatches found along the way: several already-palette functions (`dockup`, `fish-deps`, `pkg`, `play-media`, `dng2avif`) were coloring their `<placeholder>`/`[bracket]` argument text with `c_dim` instead of `c_arg`, and `scrub`'s "Aggressive Targets:" heading was still a hardcoded `set_color` call sitting next to an otherwise-converted help block. ## Test plan - [x] `fish -n` on every changed file - [x] `python3 docs/verify-manual.py` (84/84) - [x] `fish tests/run-tests.fish` (758/758 assertions, including the palette-role and colored-help-output checks, and the 250-file indent lint) - [x] Manually rendered `--help` for `gi`, `git-clean`, `scrub`, `dockup`, `fish-deps`, `pkg`, `play-media`, and `config-help` in an interactive Catppuccin Mocha shell — confirmed theme-correct colors (command=blue, flag=green, arg=flamingo/pink, heading=bold mauve) and no runtime errors - [x] Confirmed the static fallback path still renders under `--no-config` (no theme variables set)
rootiest added the Kind/FeatureArea/Functions labels 2026-09-21 05:20:25 +00:00
rootiest added 1 commit 2026-09-21 05:20:29 +00:00
__fish_palette's c_cmd/c_flag/c_arg/c_dim now read fish's own highlighter
variables (fish_color_command/option/param/autosuggestion) when set, and
c_head reads the pager's fish_pager_color_prefix, so --help text matches
whatever the user's actual theme renders at the prompt instead of a fixed
guess at it. Each role keeps its previous static value as a fallback
(e.g. a --no-config script, or the theme variable being unset or empty).

Routes __fish_help_header's title/section colors and config-help's,
gi's, and git-clean's own hand-rolled --help blocks through the palette
instead of their hardcoded set_color calls, which fixes the
--help-vs-actual-prompt color mismatch across most of the config's
functions in one place (__fish_help_header backs the majority of
user-facing --help output).

Also fixes role mismatches found along the way: several already-palette
functions (dockup, fish-deps, pkg, play-media, dng2avif) were coloring
their <placeholder>/[bracket] argument text with c_dim instead of c_arg,
and scrub's "Aggressive Targets:" heading was still a hardcoded
set_color call sitting next to an otherwise-converted help block.
rootiest added 1 commit 2026-09-21 05:36:38 +00:00
The USAGE block's "help config" was left as plain text while every
other section (EXAMPLES) correctly colored it with c_cmd.
rootiest added 1 commit 2026-09-21 05:39:07 +00:00
ov, bat, man, less, and cat were plain text, and man -l's -l wasn't
styled as a flag, in an otherwise-converted help block.
rootiest added 1 commit 2026-09-21 05:44:25 +00:00
Both had headings (Usage:/Options:/Keys in fzf:) left completely
uncolored, flags rendered in the argument color instead of the flag
color, and the command name hardcoded to a static ANSI green (c_accent)
instead of the theme-derived c_cmd -- the last of the raw, unconverted
color usage the audit turned up.
rootiest added 1 commit 2026-09-21 05:49:42 +00:00
Adds two checks to the shared-palette section, extending the existing
colored list with the functions converted in this branch (config-help,
fish-deps, gi, git-clean, mkrep):

- Every listed function's --help must contain the session's own c_head
  and c_cmd escapes -- not just some escape sequence, which the existing
  presence check already covered but which a wrong-role bug (still some
  color, just not the right one) sails through undetected.
- Every escape sequence found in --help output must be one of
  c_reset/c_head/c_cmd/c_flag/c_arg/c_dim. c_warn/c_err/c_ok/c_accent/
  c_sel/c_hi are legitimate elsewhere but never in --help text; reaching
  for one there is always a bug, which is exactly what logs and
  smart_exit did (static c_accent green for the command name).

Verified against the pre-fix smart_exit.fish (58d5cf3~1): both checks
fail on it -- missing c_head on "Options:", and a disallowed \e[32m for
the command name -- confirming this isn't a tautological pass.
rootiest merged commit cd8d6fce38 into main 2026-09-21 05:53:22 +00:00
rootiest deleted branch feat/theme-driven-help-palette 2026-09-21 05:53:22 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: rootiest/fish-config#159