Better styling.

This commit is contained in:
Tom Alexander 2022-10-19 22:35:48 -04:00
parent 5ccac6de3a
commit 9245d95449
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
2 changed files with 10 additions and 3 deletions

View File

@ -95,6 +95,9 @@
font-weight: bold;
}
#custom-clock {
}
#cpu {
/* No styles */
}

View File

@ -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,