erikflowers / weather-icons

215 Weather Themed Icons and CSS
https://github.com/erikflowers/weather-icons
6.89k stars 849 forks source link

Missing Wunderground classes for "nt_xxx" icons (if using conditions_v11 API) #203

Open Moonbase59 opened 6 years ago

Moonbase59 commented 6 years ago

Sadly, Weather Underground haven’t yet (after 6 years!) updated their API docs. For differentiating between daytime and nighttime icons, one can use the newer v11 conditions API, i.e.:

http://api.wunderground.com/api/key/conditions_v11/q/…

instead of the older

http://api.wunderground.com/api/key/conditions/q/…

which will give icon properties with a prepended nt_ if it is nighttime, much like their own URIs returned in icon_url.

For these, we’d need an appropriate class mapping within weather-icons.css.

I patched up my own copy of weather-icons.css like below, but it should be done correctly, so it’d work with SASS and other stuff. Also, the documentation needs an update.

Here’s how I changed the "Wunderground" part of weather-icons.css:

.wi-wu-chanceflurries:before {
  content: "\f065"; // wi-day-snow-wind
}
.wi-wu-chancerain:before {
  content: "\f008"; // wi-day-rain
}
.wi-wu-chancesleat:before {
  content: "\f0b2"; // wi-day-sleet
}
.wi-wu-chancesnow:before {
  content: "\f00a"; // wi-day-snow
}
.wi-wu-chancetstorms:before {
  content: "\f010"; // wi-day-thunderstorm
}
.wi-wu-clear:before {
  content: "\f00d"; // wi-day-sunny
}
.wi-wu-cloudy:before {
  content: "\f002"; // wi-day-cloudy
}
.wi-wu-flurries:before {
  content: "\f065"; // wi-day-snow-wind
}
.wi-wu-hazy:before {
  content: "\f0b6"; // wi-day-haze
}
.wi-wu-mostlycloudy:before {
  content: "\f002"; // wi-day-cloudy
}
.wi-wu-mostlysunny:before {
  content: "\f00d"; // wi-day-sunny
}
.wi-wu-partlycloudy:before {
  content: "\f002"; // wi-day-cloudy
}
.wi-wu-partlysunny:before {
  content: "\f00d"; // wi-day-sunny
}
.wi-wu-rain:before {
  content: "\f009"; // wi-day-showers
}
.wi-wu-sleat:before {
  content: "\f0b2"; // wi-day-sleet
}
.wi-wu-snow:before {
  content: "\f00a"; // wi-day-snow
}
.wi-wu-sunny:before {
  content: "\f00d"; // wi-day-sunny
}
.wi-wu-tstorms:before {
  content: "\f010"; // wi-day-thunderstorm
}
.wi-wu-unknown:before {
  content: "\f00d"; // wi-day-sunny
}
.wi-wu-nt_chanceflurries:before {
  content: "\f067"; // wi-night-alt-snow-wind
}
.wi-wu-nt_chancerain:before {
  content: "\f028"; // wi-night-alt-rain
}
.wi-wu-nt_chancesleat:before {
  content: "\f0b4"; // wi-night-alt-sleet
}
.wi-wu-nt_chancesnow:before {
  content: "\f02a"; // wi-night-alt-snow
}
.wi-wu-nt_chancetstorms:before {
  content: "\f02d"; // wi-night-alt-thunderstorm
}
.wi-wu-nt_clear:before {
  content: "\f02e"; // wi-night-clear
}
.wi-wu-nt_cloudy:before {
  content: "\f086"; // wi-night-alt-cloudy
}
.wi-wu-nt_flurries:before {
  content: "\f067"; // wi-night-alt-snow-wind
}
.wi-wu-nt_hazy:before {
  content: "\f04a"; // wi-night-fog
}
.wi-wu-nt_mostlycloudy:before {
  content: "\f086"; // wi-night-alt-cloudy
}
.wi-wu-nt_mostlysunny:before {
  content: "\f02e"; // wi-night-clear
}
.wi-wu-nt_partlycloudy:before {
  content: "\f086"; // wi-night-alt-cloudy
}
.wi-wu-nt_partlysunny:before {
  content: "\f02e"; // wi-night-clear
}
.wi-wu-nt_rain:before {
  content: "\f029"; // wi-night-alt-showers
}
.wi-wu-nt_sleat:before {
  content: "\f0b4"; // wi-night-alt-sleet
}
.wi-wu-nt_snow:before {
  content: "\f02a"; // wi-night-alt-snow
}
.wi-wu-nt_sunny:before {
  content: "\f02e"; // wi-night-clear
}
.wi-wu-nt_tstorms:before {
  content: "\f02d"; // wi-night-alt-thunderstorm
}
.wi-wu-nt_unknown:before {
  content: "\f02e"; // wi-night-clear
}