aboutsummaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authorlukeflo2025-02-21 21:55:17 +0100
committerlukeflo2025-02-21 21:55:17 +0100
commitc34412d9e3725bed48af925646110f2ca34b1bd4 (patch)
treee7f48bb25a605aeccf0c31ed310f1c7a1ae9e067 /src/config.rs
parentddb6326c1896b82b759d930fb08ea46a820e275a (diff)
downloadbibiman-c34412d9e3725bed48af925646110f2ca34b1bd4.tar.gz
bibiman-c34412d9e3725bed48af925646110f2ca34b1bd4.zip
implement working config file construct, error handling should be improved
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/config.rs b/src/config.rs
index 22873dd..faba5d8 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -72,7 +72,7 @@ impl Default for BibiConfig {
info_color: Some(Color::Indexed(99)),
confirm_color: Some(Color::Indexed(47)),
warn_color: Some(Color::Indexed(124)),
- bar_bg_color: Some(Color::Indexed(234)),
+ bar_bg_color: Some(Color::Indexed(235)),
popup_bg_color: Some(Color::Indexed(234)),
selected_row_bg_color: Some(Color::Indexed(237)),
}),
@@ -138,17 +138,6 @@ impl BibiConfig {
Ok(())
}
- pub fn new(args: &CLIArgs) -> Result<Self> {
- // let mut cfg = config::Config::builder();
- // cfg = cfg.add_source(
- // config::File::from(args.cfg_path.clone())
- // .format(FileFormat::Toml)
- // .required(false),
- // );
- // cfg.build()?.try_deserialize()
- Ok(Self::parse_cfg_file(args)?)
- }
-
fn parse_cfg_file(args: &CLIArgs) -> Result<Self, ConfigError> {
let mut cfg = config::Config::builder();
cfg = cfg.add_source(
@@ -158,6 +147,19 @@ impl BibiConfig {
);
cfg.build()?.try_deserialize()
}
+
+ /// Activates the default color scheme for light background terminals
+ pub fn light_colors(&mut self) {
+ self.colors.as_mut().unwrap().main_text_color = Some(Color::Indexed(235));
+ self.colors.as_mut().unwrap().highlight_text_color = Some(Color::Indexed(232));
+ self.colors.as_mut().unwrap().entry_color = Some(Color::Indexed(23));
+ self.colors.as_mut().unwrap().keyword_color = Some(Color::Indexed(58));
+ self.colors.as_mut().unwrap().info_color = Some(Color::Indexed(57));
+ self.colors.as_mut().unwrap().bar_bg_color = Some(Color::Indexed(144));
+ self.colors.as_mut().unwrap().popup_bg_color = Some(Color::Indexed(187));
+ self.colors.as_mut().unwrap().confirm_color = Some(Color::Indexed(22));
+ self.colors.as_mut().unwrap().selected_row_bg_color = Some(Color::Indexed(107));
+ }
}
fn select_opener() -> String {