aboutsummaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorJoris2022-02-27 13:37:27 +0100
committerJoris2022-02-27 13:37:27 +0100
commitaad7b9601dfa05255d5c24f4a6377d9a25646d45 (patch)
treee4b7013a9e27adc8980c4fa6092ad7bd3d56e77c /src/gui
parente84d7e08c780133bd16a5a320bb786b5d22fddad (diff)
Make change of months clearer in calendar
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/calendar.rs7
-rw-r--r--src/gui/style.css4
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;