feat: enhance calendar display with larger text and weekend styling
This commit is contained in:
1 parent
c5b329b3bd
commit
86ab853c4a
2 files changed
+40
-14
No files matched your search
@@ -138,7 +138,7 @@ menu > menuitem:hover > label {
|
||||
}
|
||||
|
||||
#calendar-month {
|
||||
font-size: 16px;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #68A7B5;
|
||||
margin-bottom: 8px;
|
||||
@@ -149,21 +149,35 @@ menu > menuitem:hover > label {
|
||||
}
|
||||
|
||||
#calendar-day-header {
|
||||
font-size: 10px;
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: alpha(#fff, 0.6);
|
||||
color: #ffffff;
|
||||
min-width: 18px;
|
||||
}
|
||||
|
||||
#calendar-day-header-weekend {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
color: #8E8D93;
|
||||
min-width: 18px;
|
||||
}
|
||||
|
||||
#calendar-day {
|
||||
font-size: 10px;
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: alpha(#fff, 0.8);
|
||||
color: #ffffff;
|
||||
min-width: 18px;
|
||||
}
|
||||
|
||||
#calendar-day-weekend {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: #8E8D93;
|
||||
min-width: 18px;
|
||||
}
|
||||
|
||||
#calendar-day-today {
|
||||
font-size: 10px;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
color: #0984FF;
|
||||
min-width: 18px;
|
||||
|
||||
+20
-8
@@ -484,9 +484,9 @@ class Calendar(Box):
|
||||
# Month and year header
|
||||
self.month_label = Label(
|
||||
name="calendar-month",
|
||||
label=f"{calendar.month_name[self.current_month]} {self.current_year}",
|
||||
h_align="center",
|
||||
justification="center"
|
||||
label=f"{calendar.month_name[self.current_month]}",
|
||||
h_align="start",
|
||||
justification="left"
|
||||
)
|
||||
|
||||
# Day abbreviations
|
||||
@@ -498,9 +498,11 @@ class Calendar(Box):
|
||||
)
|
||||
|
||||
day_names = ["S", "M", "T", "W", "T", "F", "S"]
|
||||
for day_name in day_names:
|
||||
for i, day_name in enumerate(day_names):
|
||||
# Saturday (6) and Sunday (0) get weekend styling
|
||||
is_weekend = i == 0 or i == 6
|
||||
day_label = Label(
|
||||
name="calendar-day-header",
|
||||
name="calendar-day-header-weekend" if is_weekend else "calendar-day-header",
|
||||
label=day_name,
|
||||
h_align="center",
|
||||
h_expand=True
|
||||
@@ -540,7 +542,7 @@ class Calendar(Box):
|
||||
self.calendar_grid.remove(child)
|
||||
|
||||
# Update month label
|
||||
self.month_label.set_label(f"{calendar.month_name[self.current_month]} {self.current_year}")
|
||||
self.month_label.set_label(f"{calendar.month_name[self.current_month]}")
|
||||
|
||||
# Get calendar for current month
|
||||
cal = calendar.monthcalendar(self.current_year, self.current_month)
|
||||
@@ -552,7 +554,7 @@ class Calendar(Box):
|
||||
h_expand=True
|
||||
)
|
||||
|
||||
for day in week:
|
||||
for day_index, day in enumerate(week):
|
||||
if day == 0:
|
||||
# Empty day
|
||||
day_label = Label(
|
||||
@@ -567,8 +569,18 @@ class Calendar(Box):
|
||||
self.current_month == datetime.datetime.now().month and
|
||||
self.current_year == datetime.datetime.now().year)
|
||||
|
||||
# Saturday (6) and Sunday (0) get weekend styling
|
||||
is_weekend = day_index == 0 or day_index == 6
|
||||
|
||||
if is_today:
|
||||
name = "calendar-day-today"
|
||||
elif is_weekend:
|
||||
name = "calendar-day-weekend"
|
||||
else:
|
||||
name = "calendar-day"
|
||||
|
||||
day_label = Label(
|
||||
name="calendar-day-today" if is_today else "calendar-day",
|
||||
name=name,
|
||||
label=str(day),
|
||||
h_align="center",
|
||||
h_expand=True
|
||||
|
||||
Reference in new issue
Block a user