Better styling.
This commit is contained in:
parent
5ccac6de3a
commit
9245d95449
@ -95,6 +95,9 @@
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#custom-clock {
|
||||
}
|
||||
|
||||
#cpu {
|
||||
/* No styles */
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ class Update:
|
||||
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
def make_calendar(today: datetime.date):
|
||||
def make_calendar(today: datetime.date, tz: datetime.tzinfo):
|
||||
width: Final[int] = 20
|
||||
start_of_month = today.replace(day=1)
|
||||
month_header = today.strftime("%B %Y")
|
||||
@ -50,6 +50,8 @@ def make_calendar(today: datetime.date):
|
||||
header = f"{left_padding}{month_header}{right_padding}"
|
||||
days_of_week = "Su Mo Tu We Th Fr Sa"
|
||||
|
||||
timezone_str = str(tz)
|
||||
|
||||
# Make the grid
|
||||
first_day_padding = " " * (
|
||||
0 if start_of_month.weekday() == 6 else (3 * (1 + start_of_month.weekday())) - 1
|
||||
@ -63,11 +65,13 @@ def make_calendar(today: datetime.date):
|
||||
else:
|
||||
output += " "
|
||||
if print_day == today:
|
||||
output += '<span foreground="blue">'
|
||||
output += '<span foreground="#323232" background="#CCCCCC">'
|
||||
output += f"{print_day.day: >2}"
|
||||
if print_day == today:
|
||||
output += "</span>"
|
||||
print_day += datetime.timedelta(days=1)
|
||||
|
||||
output += f'\n<span size="small">{timezone_str}</span>'
|
||||
return output
|
||||
|
||||
|
||||
@ -87,7 +91,7 @@ def main():
|
||||
|
||||
now = datetime.datetime.now(tz=tz)
|
||||
text = now.strftime("%Y-%m-%d %H:%M")
|
||||
tooltip = make_calendar(now.date())
|
||||
tooltip = make_calendar(now.date(), tz)
|
||||
|
||||
out = Update(
|
||||
text=text,
|
||||
|
Loading…
Reference in New Issue
Block a user