Use COSMIC Default themes as fallback

This commit is contained in:
Mattias Eriksson 2024-04-14 16:48:13 +02:00 committed by Jeremy Soller
parent c63e19eea3
commit 3e41d261a9
3 changed files with 19 additions and 11 deletions

View file

@ -1138,10 +1138,14 @@ impl App {
let colors = self
.themes
.get(&self.config.syntax_theme(profile_id_opt))
.or_else(|| {
let mut keys: Vec<_> = self.themes.keys().collect();
keys.sort_by(|a, b| (&a.0).cmp(&b.0));
keys.first().and_then(|key| self.themes.get(key))
.or_else(|| match self.config.color_scheme_kind() {
ColorSchemeKind::Dark => self
.themes
.get(&(config::COSMIC_THEME_DARK.to_string(), ColorSchemeKind::Dark)),
ColorSchemeKind::Light => self.themes.get(&(
config::COSMIC_THEME_LIGHT.to_string(),
ColorSchemeKind::Light,
)),
});
match colors {
Some(colors) => {