diff options
author | Joris | 2022-02-27 13:37:27 +0100 |
---|---|---|
committer | Joris | 2022-02-27 13:37:27 +0100 |
commit | aad7b9601dfa05255d5c24f4a6377d9a25646d45 (patch) | |
tree | e4b7013a9e27adc8980c4fa6092ad7bd3d56e77c /src/gui/calendar.rs | |
parent | e84d7e08c780133bd16a5a320bb786b5d22fddad (diff) |
Make change of months clearer in calendar
Diffstat (limited to 'src/gui/calendar.rs')
-rw-r--r-- | src/gui/calendar.rs | 7 |
1 files changed, 4 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 } |