mirror of
https://github.com/lotabout/skim.git
synced 2026-09-10 07:16:23 -04:00
fix: theme not being set with multiple values (#1049)
* fix: theme not being set with multiple values * test(theme): add better theme override tests --------- Co-authored-by: LoricAndre <57358788+LoricAndre@users.noreply.github.com>
This commit is contained in:
parent
7375d30bf1
commit
2cf64ebd46
22
src/theme.rs
22
src/theme.rs
|
|
@ -355,7 +355,7 @@ impl ColorTheme {
|
|||
if let Some((name, spec)) = pair.split_once(':') {
|
||||
theme.set_color(name, spec);
|
||||
} else {
|
||||
theme = match color {
|
||||
theme = match pair {
|
||||
"molokai" => ColorTheme::molokai256(),
|
||||
"light" => ColorTheme::light256(),
|
||||
"16" => ColorTheme::default16(),
|
||||
|
|
@ -568,14 +568,26 @@ mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_base_theme_with_overrides() {
|
||||
// Test that base theme can be overridden
|
||||
let theme = ColorTheme::from_options("dark,matched:200");
|
||||
fn test_default_theme_with_overrides() {
|
||||
// Test overriding default theme
|
||||
let theme = ColorTheme::from_options("default,matched:200");
|
||||
assert_eq!(theme.matched.fg, Some(Color::Indexed(200)));
|
||||
// Other colors should still be from dark theme
|
||||
// Other colors should still be from default theme
|
||||
assert!(theme.prompt.fg.is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_theme_with_overrides() {
|
||||
// Test overriding theme
|
||||
for opts in &["16,prompt:200", "prompt:150,16,prompt:200"] {
|
||||
let theme = ColorTheme::from_options(opts);
|
||||
assert_eq!(theme.prompt.fg, Some(Color::Indexed(200)));
|
||||
// Other colors should still be from given theme
|
||||
assert_eq!(theme.matched.fg, Some(Color::Green));
|
||||
assert_eq!(theme.matched.bg, None);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_all_component_names() {
|
||||
// Test all valid component names with their specific colors
|
||||
|
|
|
|||
Loading…
Reference in a new issue