From aad7b9601dfa05255d5c24f4a6377d9a25646d45 Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 27 Feb 2022 13:37:27 +0100 Subject: Make change of months clearer in calendar --- src/gui/calendar.rs | 7 ++++--- src/gui/style.css | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gui/calendar.rs b/src/gui/calendar.rs index 026f86b..3f5b6a7 100644 --- a/src/gui/calendar.rs +++ b/src/gui/calendar.rs @@ -120,7 +120,7 @@ pub fn day_entry( vbox.add_css_class("g-Calendar__Day--Today"); } - vbox.append(&day_label(date)); + vbox.append(&day_label(today, date)); let mut events = events .iter() @@ -142,17 +142,18 @@ pub fn day_entry( .build() } -fn day_label(date: NaiveDate) -> gtk::Label { +fn day_label(today: NaiveDate, date: NaiveDate) -> gtk::Label { let label = gtk::Label::builder() .label(&format!( "{} {}", date.day(), - MONTHES[date.month0() as usize] + if date == today || date.day() == 1 { MONTHES[date.month0() as usize] } else { "" } )) .halign(gtk::Align::Start) .build(); label.add_css_class("g-Calendar__DayNumber"); + if date.day() == 1 { label.add_css_class("g-Calendar__DayNumber--FirstOfMonth") } label } diff --git a/src/gui/style.css b/src/gui/style.css index 4828e41..70385d1 100644 --- a/src/gui/style.css +++ b/src/gui/style.css @@ -22,6 +22,10 @@ margin-bottom: 4px; } +.g-Calendar__DayNumber--FirstOfMonth { + font-weight: bold; +} + .g-Calendar__DayEvent { background-color: #A8C2E0; color: white; -- cgit v1.2.3