diff options
-rw-r--r-- | src/theme.rs | 10 | ||||
-rw-r--r-- | src/views.rs | 20 |
2 files changed, 17 insertions, 13 deletions
diff --git a/src/theme.rs b/src/theme.rs index e373b72..7ae9efc 100644 --- a/src/theme.rs +++ b/src/theme.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use cursive::theme::Color::*; | 1 | use cursive::theme::Color::{self, *}; |
2 | use cursive::theme::PaletteColor::*; | 2 | use cursive::theme::PaletteColor::*; |
3 | use cursive::theme::{BorderStyle, ColorStyle, Palette, Style, Theme}; | 3 | use cursive::theme::{BorderStyle, ColorStyle, Palette, Style, Theme}; |
4 | 4 | ||
@@ -25,10 +25,6 @@ pub fn theme_gen() -> Theme { | |||
25 | return t; | 25 | return t; |
26 | } | 26 | } |
27 | 27 | ||
28 | pub fn cursor_gen(foreground: Style) -> Style { | 28 | pub fn cursor_bg() -> Color { |
29 | Style::from(ColorStyle::new( | 29 | Light(cursive::theme::BaseColor::Black) |
30 | TerminalDefault, | ||
31 | Light(cursive::theme::BaseColor::Blue), | ||
32 | )) | ||
33 | .combine(foreground) | ||
34 | } | 30 | } |
diff --git a/src/views.rs b/src/views.rs index a0beb2c..a306602 100644 --- a/src/views.rs +++ b/src/views.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use cursive::direction::Direction; | 1 | use cursive::direction::Direction; |
2 | use cursive::event::{Event, EventResult, Key}; | 2 | use cursive::event::{Event, EventResult, Key}; |
3 | use cursive::theme::{Effect, Style}; | 3 | use cursive::theme::{ColorStyle, ColorType, Effect, Style}; |
4 | use cursive::view::View; | 4 | use cursive::view::View; |
5 | use cursive::{Printer, Vec2}; | 5 | use cursive::{Printer, Vec2}; |
6 | 6 | ||
@@ -8,7 +8,7 @@ use chrono::prelude::*; | |||
8 | use chrono::{Local, NaiveDate}; | 8 | use chrono::{Local, NaiveDate}; |
9 | 9 | ||
10 | use crate::habit::{Bit, Count, Habit, TrackEvent, ViewMode}; | 10 | use crate::habit::{Bit, Count, Habit, TrackEvent, ViewMode}; |
11 | use crate::theme::cursor_gen; | 11 | use crate::theme::cursor_bg; |
12 | use crate::utils::VIEW_WIDTH; | 12 | use crate::utils::VIEW_WIDTH; |
13 | 13 | ||
14 | use crate::CONFIGURATION; | 14 | use crate::CONFIGURATION; |
@@ -112,12 +112,20 @@ where | |||
112 | let draw_day = |printer: &Printer| { | 112 | let draw_day = |printer: &Printer| { |
113 | let mut i = 0; | 113 | let mut i = 0; |
114 | while let Some(d) = NaiveDate::from_ymd_opt(year, month, i + 1) { | 114 | while let Some(d) = NaiveDate::from_ymd_opt(year, month, i + 1) { |
115 | let mut day_style = todo_style; | 115 | let mut day_style = Style::none(); |
116 | let mut fs = future_style; | ||
117 | let grs = ColorStyle::front(CONFIGURATION.reached_color()); | ||
118 | let ts = ColorStyle::front(CONFIGURATION.todo_color()); | ||
119 | let cs = ColorStyle::back(cursor_bg()); | ||
120 | |||
116 | if self.reached_goal(d) { | 121 | if self.reached_goal(d) { |
117 | day_style = goal_reached_style; | 122 | day_style = day_style.combine(Style::from(grs)); |
123 | } else { | ||
124 | day_style = day_style.combine(Style::from(ts)); | ||
118 | } | 125 | } |
119 | if d == now && printer.focused { | 126 | if d == now && printer.focused { |
120 | day_style = day_style.combine(cursor_gen(day_style)); | 127 | day_style = day_style.combine(cs); |
128 | fs = fs.combine(cs); | ||
121 | } | 129 | } |
122 | let coords: Vec2 = ((i % 7) * 3, i / 7 + 2).into(); | 130 | let coords: Vec2 = ((i % 7) * 3, i / 7 + 2).into(); |
123 | if let Some(c) = self.get_by_date(d) { | 131 | if let Some(c) = self.get_by_date(d) { |
@@ -125,7 +133,7 @@ where | |||
125 | p.print(coords, &format!("{:^3}", c)); | 133 | p.print(coords, &format!("{:^3}", c)); |
126 | }); | 134 | }); |
127 | } else { | 135 | } else { |
128 | printer.with_style(future_style, |p| { | 136 | printer.with_style(fs, |p| { |
129 | p.print(coords, &format!("{:^3}", CONFIGURATION.look.future_chr)); | 137 | p.print(coords, &format!("{:^3}", CONFIGURATION.look.future_chr)); |
130 | }); | 138 | }); |
131 | } | 139 | } |