summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkshay <nerdy@peppe.rs>2021-01-25 15:21:36 +0530
committerAkshay <nerdy@peppe.rs>2021-01-25 15:21:36 +0530
commitc26de6fbfd55cca906b9c184621a9f550cdcc0f1 (patch)
treec607cd0e5ba3d371a4d4529a76dde3305c3a8807
parent85670bd3c1297053592c8c2863185bda681d5185 (diff)
attempt to style cursor
-rw-r--r--src/theme.rs5
-rw-r--r--src/views.rs8
2 files changed, 8 insertions, 5 deletions
diff --git a/src/theme.rs b/src/theme.rs
index 7ee65a1..e373b72 100644
--- a/src/theme.rs
+++ b/src/theme.rs
@@ -25,9 +25,10 @@ pub fn theme_gen() -> Theme {
return t;
}
-pub fn cursor_gen() -> Style {
+pub fn cursor_gen(foreground: Style) -> Style {
Style::from(ColorStyle::new(
- Light(cursive::theme::BaseColor::Blue),
TerminalDefault,
+ Light(cursive::theme::BaseColor::Blue),
))
+ .combine(foreground)
}
diff --git a/src/views.rs b/src/views.rs
index 4f78ca2..a0beb2c 100644
--- a/src/views.rs
+++ b/src/views.rs
@@ -44,7 +44,6 @@ where
let todo_style = Style::from(CONFIGURATION.todo_color());
let future_style = Style::from(CONFIGURATION.inactive_color());
- let cursor_style = cursor_gen();
let strikethrough = Style::from(Effect::Strikethrough);
let goal_status = is_today && self.reached_goal(Local::now().naive_local().date());
@@ -113,9 +112,12 @@ where
let draw_day = |printer: &Printer| {
let mut i = 0;
while let Some(d) = NaiveDate::from_ymd_opt(year, month, i + 1) {
- let mut day_style = cursor_style.combine(todo_style);
+ let mut day_style = todo_style;
if self.reached_goal(d) {
- day_style = day_style.combine(goal_reached_style);
+ day_style = goal_reached_style;
+ }
+ if d == now && printer.focused {
+ day_style = day_style.combine(cursor_gen(day_style));
}
let coords: Vec2 = ((i % 7) * 3, i / 7 + 2).into();
if let Some(c) = self.get_by_date(d) {