diff --git a/agenda/__init__.py b/agenda/__init__.py index 62bff02..e5ee290 100644 --- a/agenda/__init__.py +++ b/agenda/__init__.py @@ -56,6 +56,23 @@ config.read(config_filename) access_key = config.get("exchangerate", "access_key") 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: """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(), "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: item["url"] = e.url items.append(item)