Skip to content

feat: add nighttime weather icons based on sunrise/sunset - #140

Merged
michaeljolley merged 1 commit into
mainfrom
dev/mjolley/feature-nighttime-weather-icons
Jun 21, 2026
Merged

feat: add nighttime weather icons based on sunrise/sunset#140
michaeljolley merged 1 commit into
mainfrom
dev/mjolley/feature-nighttime-weather-icons

Conversation

@michaeljolley

Copy link
Copy Markdown
Contributor

Summary

Displays moon/night icons when the current time is after sunset or before sunrise, addressing the issue where the sun icon was displayed at night.

Changes

  • Model updates: Added IsDay property to CurrentWeather, Sunrise/Sunset to DailyForecast, and new HourlyDailyInfo class for hourly forecast sunrise/sunset data
  • API requests: Updated Open-Meteo API calls to request is_day (current weather), sunrise,sunset (forecast and hourly forecast)
  • Nighttime icons: Added ClearSkyNight (🌙), MainlyClearNight (🌙), PartlyCloudyNight (☁️), and WeatherIconNight (🌙) variants
  • Icon selection: Updated GetIconForWeatherCode with an optional isNight parameter that selects night variants for clear/partly cloudy conditions
  • Caller updates:
    • PinnedWeatherBand, WeatherDetailPage, WeatherListPage use current.IsDay == 0
    • HourlyForecastPage compares each hour against sunrise/sunset times

Design decisions

  • Only clear sky, mainly clear, and partly cloudy conditions get night variants — precipitation/fog/snow icons are already appropriate for any time of day
  • Daily forecast items remain as daytime icons since they represent the whole day
  • Falls back to daytime icons if sunrise/sunset data is unavailable

Closes #138

Display moon/night icons when the current time is after sunset or
before sunrise. For current weather, use the is_day field from the
Open-Meteo API. For hourly forecasts, request daily sunrise/sunset
data and compare each hour against those times.

- Add IsDay property to CurrentWeather model
- Add sunrise/sunset to DailyForecast and HourlyDailyInfo models
- Add nighttime icon variants (ClearSkyNight, MainlyClearNight, etc.)
- Update GetIconForWeatherCode with optional isNight parameter
- Update all callers to pass night state

Closes #138

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@michaeljolley michaeljolley self-assigned this Jun 21, 2026
@michaeljolley
michaeljolley merged commit 03f054b into main Jun 21, 2026
2 checks passed
@michaeljolley
michaeljolley deleted the dev/mjolley/feature-nighttime-weather-icons branch June 21, 2026 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add weather icons for nighttime

1 participant