index.html:
index.html
lucide.createIcons() is called to replace every <i data-lucide="..."> element with the corresponding SVG.
How icons are mapped to weather codes
ThegetWeatherIcon(code) function in script.js takes a WMO weather interpretation code and returns an HTML string with the matching Lucide icon and color:
script.js
| WMO code | Condition | Icon | Color |
|---|---|---|---|
0 | Clear sky | sun | #ffb703 (amber) |
1–3 | Partly cloudy | cloud | #8ecae6 (light blue) |
4+ | Rain / precipitation | cloud-rain | #007bff (blue) |
lucide.createIcons() must be called after injecting HTML that contains data-lucide attributes, or the icons will not render. The existing showCurrent(), show24h(), and show30d() functions already do this.Adding more granular icon mappings
The current mapping covers three broad ranges. You can extendgetWeatherIcon to handle more specific WMO codes. The full WMO code table is available in the Open-Meteo docs.
script.js
Changing icon colors
Each icon’s color is set via an inlinestyle="color: ..." attribute inside the string returned by getWeatherIcon. Update the hex value for any condition to change its color:
script.js
Lucide icons are rendered as inline SVGs. The
color CSS property sets their currentColor, which fills the SVG stroke. You can also control width, height, and stroke-width with additional inline styles if needed.Logo icons
The app logo inindex.html uses two Lucide icons that animate in an arc above the SkyAI wordmark:
index.html
- The
sunicon is visible by default and fades out on hover. - The
cloud-rainicon is hidden by default and fades in on hover.
weatherArcPath animation defined in style.css to travel across the arc. Their colors are controlled by the .sun-icon and .rain-icon CSS rules:
style.css
Swapping logo icons
To use different icons in the logo, change thedata-lucide attribute on either <i> element to any valid Lucide icon name:
index.html