mirror of
https://github.com/openai/codex.git
synced 2026-12-05 01:00:54 +00:00
## What changed - Bundle `ada`, `babbage`, `curie`, `cushman`, `dali`, and `davinci` themes for configuration and the theme picker, preserving precedence and invalid-file warnings for custom themes with the same names. - Use `codex.accent` for active and selected controls on truecolor and 256-color terminals, retaining existing fallbacks at lower color depths. - Honor terminal-default diff backgrounds and clear matching gutter fills, allowing `dali` and `davinci` to show diffs without background fills. - Restrict Windows native palette fallback to `ConsoleWindowClass` so a ConPTY palette is not mistaken for the renderer's colors when OSC probing fails. ## Testing Add tests and snapshots for theme preview, selection, cancellation, custom-theme precedence, invalid-file warnings, accent color depth, and disabling individual diff fills. GitOrigin-RevId: 72f3ef08f82626436dd2d80d40210cc77e1a5616
29 lines
891 B
Rust
29 lines
891 B
Rust
//! Fixed model-named theme assets loaded through the standard TextMate parser.
|
|
|
|
use std::io::Cursor;
|
|
use syntect::highlighting::Theme;
|
|
use syntect::highlighting::ThemeSet;
|
|
|
|
pub(super) const THEMES: &[(&str, &str)] = &[
|
|
("ada", include_str!("../../assets/themes/ada.tmTheme")),
|
|
(
|
|
"babbage",
|
|
include_str!("../../assets/themes/babbage.tmTheme"),
|
|
),
|
|
("curie", include_str!("../../assets/themes/curie.tmTheme")),
|
|
(
|
|
"cushman",
|
|
include_str!("../../assets/themes/cushman.tmTheme"),
|
|
),
|
|
("dali", include_str!("../../assets/themes/dali.tmTheme")),
|
|
(
|
|
"davinci",
|
|
include_str!("../../assets/themes/davinci.tmTheme"),
|
|
),
|
|
];
|
|
|
|
pub(super) fn resolve(name: &str) -> Option<Theme> {
|
|
let (_, source) = THEMES.iter().find(|(key, _)| *key == name)?;
|
|
ThemeSet::load_from_reader(&mut Cursor::new(source.as_bytes())).ok()
|
|
}
|