mirror of
https://github.com/openai/codex.git
synced 2026-10-19 17:28:46 +00:00
## Why Theme colors and dimmed text can lose contrast against terminal and shaded backgrounds. Pickers also need to keep controls and the selected result visible when space is limited. ## What changed - Add shared blue accents and contrast-aware foregrounds that account for painted backgrounds and terminal color depth, with terminal-default fallbacks for limited palettes. - Apply readable colors to footer text, status lines, prompt attachment labels, and diff content. Remove dimming from syntax-highlighted diff text so it does not undo contrast correction. - Use compact shortcut labels such as `ctrl+c`, emphasize complete key combinations, and separate composer footer actions with ` · `. - Add an opt-in picker presentation with full-width selection, filled tabs, separate overflow indicators, and navigation based on visible rows. Enable it for `/keymap`, reserving result space to keep controls stable across filtering and tab changes. ## Testing Add regression tests and snapshots for contrast after palette conversion, shaded diff backgrounds, shortcut typography, picker resizing and pagination, Unicode tab truncation, and stable `/keymap` geometry. GitOrigin-RevId: f3c71879d3bcc4e3b29d70e63cf377dea5914916
2.2 KiB
2.2 KiB
Headers, primary, and secondary text
-
Headers: Use
bold. For markdown with various header levels, leave in the#signs. -
Primary text: Default.
-
Secondary text: Use
style::secondary_text_style()for shared footer descriptions and status lines. It resolves a readable muted foreground when the terminal palette is known and clears inherited dim/bold modifiers. Other secondary surfaces may still usedim. -
Keyboard hints: Use
key_hintspan helpers for compact, uniformly bold shortcut labels and readable secondary descriptions. Include+,/, and chord separators in the label's emphasis. The?shortcut reference uses readable accent-colored keys without bold. Separate composer footer actions with·.
Foreground colors
- Default: Most of the time, just use the default foreground color.
resetcan help get it back. - Active controls and input emphasis: Use
style::accent_style()orstyle::accent_color_on(background)for text on a painted surface. - Semantic statuses: Use
style::status_style(StatusTone); terminal-owned ANSI colors remain the fallback for limited palettes. - Success and additions: Use ANSI
green. - Errors, failures and deletions: Use ANSI
red. - Codex: Use ANSI
magenta.
Avoid
- Avoid unchecked custom foreground colors. Use
style::readable_color_on(color, background)for theme-derived text, passing the background actually painted behind it.Nonemeans the terminal background; color reduction is included in the contrast check. When the background is unknown, supported theme colors are preserved rather than guessed. Generic code renderers preserve configured syntax foregrounds; diff rendering resolves them against its add/delete fills. - Avoid ANSI
black&whiteas foreground colors because the default terminal theme color will do a better job. (Useresetif you need to in order to get those.) The exception is if you need contrast rendering over a manually colored background. - Avoid ANSI
blueandyellowbecause for now the style guide doesn't use them. Prefer a foreground color mentioned above.
(There are some rules to try to catch this in clippy.toml.)