package web import "time" // Weather is the seasonal effect rendered behind the page. Tuned for Lisbon: // winter is rainy (not snowy), May gets its own jacaranda variant since the // city turns purple for a few weeks each year, and September stays in summer // because Portugal's dry spell runs all the way through it. type Weather struct { Season string // "winter" | "spring" | "summer" | "autumn" Variant string // "rain" | "petals" | "jacaranda" | "motes" | "leaves" Intensity string // "light" | "medium" | "heavy" } var lisbon = func() *time.Location { loc, err := time.LoadLocation("Europe/Lisbon") if err != nil { return time.UTC } return loc }() func currentWeather(now time.Time) Weather { t := now.In(lisbon) var season, variant string switch t.Month() { case time.December, time.January, time.February: season, variant = "winter", "rain" case time.March, time.April: season, variant = "spring", "petals" case time.May: season, variant = "spring", "jacaranda" case time.June, time.July, time.August, time.September: season, variant = "summer", "motes" default: // Oct, Nov season, variant = "autumn", "leaves" } return Weather{Season: season, Variant: variant, Intensity: "heavy"} }