parent
e076578366
commit
3acad3649d
|
@ -56,6 +56,23 @@ config.read(config_filename)
|
||||||
access_key = config.get("exchangerate", "access_key")
|
access_key = config.get("exchangerate", "access_key")
|
||||||
data_dir = config.get("data", "dir")
|
data_dir = config.get("data", "dir")
|
||||||
|
|
||||||
|
colors = {
|
||||||
|
"primary-subtle": "#cfe2ff",
|
||||||
|
"secondary-subtle": "#e2e3e5",
|
||||||
|
"success-subtle": "#d1e7dd",
|
||||||
|
"info-subtle": "#cff4fc",
|
||||||
|
"warning-subtle": "#fff3cd",
|
||||||
|
"danger-subtle": "#f8d7da",
|
||||||
|
}
|
||||||
|
|
||||||
|
event_type_color_map = {
|
||||||
|
"bank_holiday": "success-subtle",
|
||||||
|
"conference": "primary-subtle",
|
||||||
|
"us_holiday": "secondary-subtle",
|
||||||
|
"birthday": "info-subtle",
|
||||||
|
"waste_schedule": "danger-subtle",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def extract_weekday_date(html: str) -> date | None:
|
def extract_weekday_date(html: str) -> date | None:
|
||||||
"""Furthest date of GWR advance ticket booking."""
|
"""Furthest date of GWR advance ticket booking."""
|
||||||
|
@ -651,6 +668,9 @@ def build_events_for_calendar(events: list[Event]) -> list[dict[str, typing.Any]
|
||||||
"start": e.date.isoformat(),
|
"start": e.date.isoformat(),
|
||||||
"end": end.isoformat(),
|
"end": end.isoformat(),
|
||||||
}
|
}
|
||||||
|
if e.name in event_type_color_map:
|
||||||
|
item["color"] = colors[event_type_color_map[e.name]]
|
||||||
|
item["textColor"] = "black"
|
||||||
if e.url:
|
if e.url:
|
||||||
item["url"] = e.url
|
item["url"] = e.url
|
||||||
items.append(item)
|
items.append(item)
|
||||||
|
|
Loading…
Reference in a new issue