Skip to content

Commit

Permalink
Address final review
Browse files Browse the repository at this point in the history
  • Loading branch information
casperstorm committed Sep 24, 2024
1 parent b42babd commit 5cd1ae8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
14 changes: 6 additions & 8 deletions data/src/appearance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,11 @@ impl Default for Selected {
}

impl Selected {
pub fn new(first: Theme, second: Option<Theme>) -> Selected {
match second {
Some(second) => Selected::Dynamic {
light: first,
dark: second,
},
None => Selected::Static(first),
}
pub fn dynamic(light: Theme, dark: Theme) -> Selected {
Selected::Dynamic { light, dark }
}

pub fn specific(theme: Theme) -> Selected {
Selected::Static(theme)
}
}
13 changes: 8 additions & 5 deletions data/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ pub use self::proxy::Proxy;
pub use self::server::Server;
pub use self::sidebar::Sidebar;

use crate::appearance::theme::Colors;
use crate::appearance::{self, Appearance};
use crate::audio::{self, Sound};
use crate::environment::config_dir;
use crate::server::Map as ServerMap;
use crate::appearance::theme::Colors;
use crate::{environment, Theme};

pub mod buffer;
Expand Down Expand Up @@ -272,10 +272,13 @@ impl Config {
all.push(Theme::default());
}

Ok(Appearance {
selected: appearance::Selected::new(first_theme, second_theme),
all,
})
let selected = if let Some(second_theme) = second_theme {
appearance::Selected::dynamic(first_theme, second_theme)
} else {
appearance::Selected::specific(first_theme)
};

Ok(Appearance { selected, all })
}

pub fn create_initial_config() {
Expand Down

0 comments on commit 5cd1ae8

Please sign in to comment.