Use window background for cosmic color schemes (#102)

This commit is contained in:
Jeremy Soller 2024-01-31 11:20:15 -07:00
parent 470437e55a
commit c0d7fed185
No known key found for this signature in database
GPG key ID: D02FD439211AF56F
2 changed files with 12 additions and 6 deletions

View file

@ -102,10 +102,16 @@ fn convert_color(colors: &Colors, color: Color) -> cosmic_text::Color {
let rgb = match color { let rgb = match color {
Color::Named(named_color) => match colors[named_color] { Color::Named(named_color) => match colors[named_color] {
Some(rgb) => rgb, Some(rgb) => rgb,
None => { None => match named_color {
log::warn!("missing named color {:?}", named_color); NamedColor::Background => {
Rgb::default() // Allow using an unset background
} return cosmic_text::Color(0);
}
_ => {
log::warn!("missing named color {:?}", named_color);
Rgb::default()
}
},
}, },
Color::Spec(rgb) => rgb, Color::Spec(rgb) => rgb,
Color::Indexed(index) => match colors[index as usize] { Color::Indexed(index) => match colors[index as usize] {

View file

@ -476,7 +476,7 @@ fn cosmic_dark() -> Colors {
// Set special colors // Set special colors
colors[NamedColor::Foreground] = colors[NamedColor::BrightWhite]; colors[NamedColor::Foreground] = colors[NamedColor::BrightWhite];
colors[NamedColor::Background] = colors[NamedColor::Black]; // Background comes from theme settings: colors[NamedColor::Background] = colors[NamedColor::Black];
colors[NamedColor::Cursor] = colors[NamedColor::BrightWhite]; colors[NamedColor::Cursor] = colors[NamedColor::BrightWhite];
colors[NamedColor::BrightForeground] = colors[NamedColor::BrightWhite]; colors[NamedColor::BrightForeground] = colors[NamedColor::BrightWhite];
@ -517,7 +517,7 @@ fn cosmic_light() -> Colors {
// Set special colors // Set special colors
colors[NamedColor::Foreground] = colors[NamedColor::Black]; colors[NamedColor::Foreground] = colors[NamedColor::Black];
colors[NamedColor::Background] = colors[NamedColor::BrightWhite]; // Background comes from theme settings: colors[NamedColor::Background] = colors[NamedColor::BrightWhite];
colors[NamedColor::Cursor] = colors[NamedColor::Black]; colors[NamedColor::Cursor] = colors[NamedColor::Black];
colors[NamedColor::BrightForeground] = colors[NamedColor::BrightBlack]; colors[NamedColor::BrightForeground] = colors[NamedColor::BrightBlack];