diff --git a/src/theme.rs b/src/theme.rs index 879584c..264bef4 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -1,4 +1,4 @@ -use cursive::theme::Color::{self, *}; +use cursive::theme::Color::*; use cursive::theme::PaletteColor::*; use cursive::theme::{BorderStyle, Palette, Theme}; @@ -25,6 +25,6 @@ pub fn theme_gen() -> Theme { return t; } -pub fn cursor_bg() -> Color { - Light(cursive::theme::BaseColor::Black) -} +// pub fn cursor_bg() -> Color { +// Light(cursive::theme::BaseColor::Black) +// } diff --git a/src/utils.rs b/src/utils.rs index f5a25c8..d11ba7b 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -44,8 +44,11 @@ pub struct Colors { pub todo: String, #[serde(default = "light_black")] pub inactive: String, + #[serde(default = "dark_white")] + pub cursor: String, } +// Cyan and Magenta are dark by default fn cyan() -> String { "cyan".into() } @@ -55,6 +58,58 @@ fn magenta() -> String { fn light_black() -> String { "light black".into() } +#[allow(dead_code)] +fn light_cyan() -> String { + "light cyan".into() +} +#[allow(dead_code)] +fn light_magenta() -> String { + "light magenta".into() +} +#[allow(dead_code)] +fn light_blue() -> String { + "light blue".into() +} +#[allow(dead_code)] +fn light_green() -> String { + "light green".into() +} +#[allow(dead_code)] +fn light_red() -> String { + "light red".into() +} +#[allow(dead_code)] +fn light_white() -> String { + "light white".into() +} +#[allow(dead_code)] +fn light_yellow() -> String { + "light yellow".into() +} +#[allow(dead_code)] +fn dark_white() -> String { + "dark white".into() +} +#[allow(dead_code)] +fn dark_black() -> String { + "dark black".into() +} +#[allow(dead_code)] +fn dark_blue() -> String { + "dark blue".into() +} +#[allow(dead_code)] +fn dark_green() -> String { + "dark green".into() +} +#[allow(dead_code)] +fn dark_red() -> String { + "dark red".into() +} +#[allow(dead_code)] +fn dark_yellow() -> String { + "dark yellow".into() +} impl Default for Colors { fn default() -> Self { @@ -62,6 +117,7 @@ impl Default for Colors { reached: cyan(), todo: magenta(), inactive: light_black(), + cursor: light_black(), } } } @@ -95,6 +151,9 @@ impl AppConfig { pub fn inactive_color(&self) -> Color { return Color::parse(&self.colors.inactive).unwrap_or(Color::Light(BaseColor::Black)); } + pub fn cursor_color(&self) -> Color { + return Color::parse(&self.colors.cursor).unwrap_or(Color::Light(BaseColor::Black)); + } } pub fn load_configuration_file() -> AppConfig { diff --git a/src/views.rs b/src/views.rs index 1bda8a8..2ce8244 100644 --- a/src/views.rs +++ b/src/views.rs @@ -8,7 +8,7 @@ use chrono::prelude::*; use chrono::{Local, NaiveDate}; use crate::habit::{Bit, Count, Float, Habit, TrackEvent, ViewMode}; -use crate::theme::cursor_bg; +// use crate::theme::cursor_bg; use crate::utils::VIEW_WIDTH; use crate::CONFIGURATION; @@ -115,7 +115,7 @@ where let mut fs = future_style; let grs = ColorStyle::front(CONFIGURATION.reached_color()); let ts = ColorStyle::front(CONFIGURATION.todo_color()); - let cs = ColorStyle::back(cursor_bg()); + let cs = ColorStyle::back(CONFIGURATION.cursor_color()); if self.reached_goal(d) { day_style = day_style.combine(Style::from(grs));