Commit 801da48
committed
sphinx-gp-theme(pygments[light]): give Generic.Prompt + Generic.Output distinctive light-mode colours
why: User noted the light Pygments style lacks the visual distinction
dark mode (monokai) has for shell prompts (`$`, `>>>`, etc.) and
command-output samples. Dark gives:
body[data-theme="dark"] .highlight .gp → #FF4689 (pink, bold)
body[data-theme="dark"] .highlight .go → #66D9EF (cyan)
Light's gp-sphinx-light style mapped both tokens to plain `#475569`
(slate-600) — the same colour `Name.Label` and `Generic.Subheading`
already use. Net effect: in light mode, prompts and output were
visually indistinguishable from surrounding `bold` subheadings,
losing the "prompt vs. output" cue that dark delivers via
pink-vs-cyan contrast.
User asked specifically for purple on `.gp`. Audit of every other
dark-mode override against light's mapping confirmed the same
asymmetry on `.go` (cyan in dark, generic slate in light); fixing
both to honour the broader directive: "for any dark-mode override,
ensure light has a specialized override too."
what:
- packages/sphinx-gp-theme/src/sphinx_gp_theme/pygments_styles.py:
two `styles[…]` map entries change, with an 8-line comment block
explaining the asymmetry that motivated the picks:
Generic.Output: "#475569" → "#0891b2" (cyan-600)
Generic.Prompt: "bold #475569" → "bold #a855f7" (purple-500, bold)
Colour rationale:
- #a855f7 (Tailwind purple-500) is already in the palette for
`Name.Decorator`, `Name.Function.Magic`, `Name.Variable.Magic`
— keeps the palette tight at 11 distinct colours rather than
introducing a 12th. It's clearly distinct from `#7c3aed`
(violet-600) used for keywords, so prompts read as their own
visual class.
- #0891b2 (Tailwind cyan-600) is the natural light-mode mirror
of dark's `#66D9EF` cyan choice for the same token — same
"this is sample output, not your code" semantic cue, just at
a luminance suited to the slate-50 background.
- tests/test_pygments_style.py:
+2 TokenColorCase entries in `_TOKEN_COLOR_FIXTURES` so future
drift on either token fails the parametrized
`test_gp_sphinx_light_token_palette` rather than waiting for a
user to notice in rendered output:
test_id="generic-prompt-purple" → expected_substring="#a855f7"
test_id="generic-output-cyan" → expected_substring="#0891b2"
- tests/__snapshots__/test_pygments_style.ambr:
syrupy snapshot regenerated via `pytest --snapshot-update`. Diff
is exactly the two intended lines (gp + go); no other token
rules drifted.
The other 9 token classes the audit checked (`.k*`, `.c*`, `.s*`,
`.mi`, `.gd`, `.gi`, `.gs`, `.gh`, `.gr`) all already specialize
in BOTH modes; only `.gp` and `.go` had the gap.
Pre-commit gate: ruff/mypy/pytest 1315 passed (was 1313, +2 new
parametrized cases)/159 skipped/just build-docs all green.1 parent c319f9c commit 801da48
3 files changed
Lines changed: 28 additions & 4 deletions
File tree
- packages/sphinx-gp-theme/src/sphinx_gp_theme
- tests
- __snapshots__
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
136 | | - | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
137 | 146 | | |
138 | 147 | | |
139 | 148 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
| 32 | + | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
110 | 125 | | |
111 | 126 | | |
112 | 127 | | |
| |||
0 commit comments