Swap weather icons to FOSS ones by Erik Flowers
authorStephen Jianu <stephen@stephenjianu.com>
Sun, 30 Mar 2025 15:38:29 +0000 (10:38 -0500)
committerStephen Jianu <stephen@stephenjianu.com>
Sun, 30 Mar 2025 15:38:29 +0000 (10:38 -0500)
.gitmodules [new file with mode: 0644]
README.md
descriptions.json
index.php
weather-icons [new submodule]

diff --git a/.gitmodules b/.gitmodules
new file mode 100644 (file)
index 0000000..ea9d4d5
--- /dev/null
@@ -0,0 +1,3 @@
+[submodule "weather-icons"]
+       path = weather-icons
+       url = https://github.com/erikflowers/weather-icons
index 2027c4ec8849c25d15e3f28b1b4bda141b7da122..78cc4efb6ce80f1f9fb1be9ce49103f6eceada67 100644 (file)
--- a/README.md
+++ b/README.md
@@ -14,4 +14,6 @@ docker run -d -p 6969:80 --restart=unless-stopped --name reasonableweather regis
 ```
 
 ### Credits
-This site uses the excellent [Open-Meteo API](https://open-meteo.com/) as well as a [JSON mapping of weather codes by GitHub user stellasphere](https://gist.github.com/stellasphere/9490c195ed2b53c707087c8c2db4ec0c).
+* [Open-Meteo API](https://open-meteo.com/)
+* [JSON mapping of weather codes by GitHub user stellasphere](https://gist.github.com/stellasphere/9490c195ed2b53c707087c8c2db4ec0c)
+* [Weather Icons by Erik Flowers](https://github.com/erikflowers/weather-icons/)
index 8ca158734e2c39191b472c53531a2fe4fed37773..8eb07bdda39ed4a4cd722c3bb988404de006df37 100644 (file)
        "0":{
                "day":{
                        "description":"Sunny",
-                       "image":"http://openweathermap.org/img/wn/01d@2x.png"
+                       "image":"wi-day-sunny"
                },
                "night":{
                        "description":"Clear",
-                       "image":"http://openweathermap.org/img/wn/01n@2x.png"
+                       "image":"wi-night-clear"
                }
        },
        "1":{
                "day":{
                        "description":"Mainly Sunny",
-                       "image":"http://openweathermap.org/img/wn/01d@2x.png"
+                       "image":"wi-day-sunny"
                },
                "night":{
                        "description":"Mainly Clear",
-                       "image":"http://openweathermap.org/img/wn/01n@2x.png"
+                       "image":"wi-night-clear"
                }
        },
        "2":{
                "day":{
                        "description":"Partly Cloudy",
-                       "image":"http://openweathermap.org/img/wn/02d@2x.png"
+                       "image":"wi-night-partly-cloudy"
                },
                "night":{
                        "description":"Partly Cloudy",
-                       "image":"http://openweathermap.org/img/wn/02n@2x.png"
+                       "image":"wi-night-partly-cloudy"
                }
        },
        "3":{
                "day":{
                        "description":"Cloudy",
-                       "image":"http://openweathermap.org/img/wn/03d@2x.png"
+                       "image":"wi-day-cloudy"
                },
                "night":{
                        "description":"Cloudy",
-                       "image":"http://openweathermap.org/img/wn/03n@2x.png"
+                       "image":"wi-night-cloudy"
                }
        },
        "45":{
                "day":{
                        "description":"Foggy",
-                       "image":"http://openweathermap.org/img/wn/50d@2x.png"
+                       "image":"wi-day-fog"
                },
                "night":{
                        "description":"Foggy",
-                       "image":"http://openweathermap.org/img/wn/50n@2x.png"
+                       "image":"wi-night-fog"
                }
        },
        "48":{
                "day":{
                        "description":"Rime Fog",
-                       "image":"http://openweathermap.org/img/wn/50d@2x.png"
+                       "image":"wi-day-fog"
                },
                "night":{
                        "description":"Rime Fog",
-                       "image":"http://openweathermap.org/img/wn/50n@2x.png"
+                       "image":"wi-night-fog"
                }
        },
        "51":{
                "day":{
                        "description":"Light Drizzle",
-                       "image":"http://openweathermap.org/img/wn/09d@2x.png"
+                       "image":"wi-day-rain"
                },
                "night":{
                        "description":"Light Drizzle",
-                       "image":"http://openweathermap.org/img/wn/09n@2x.png"
+                       "image":"wi-night-rain"
                }
        },
        "53":{
                "day":{
                        "description":"Drizzle",
-                       "image":"http://openweathermap.org/img/wn/09d@2x.png"
+                       "image":"wi-day-rain"
                },
                "night":{
                        "description":"Drizzle",
-                       "image":"http://openweathermap.org/img/wn/09n@2x.png"
+                       "image":"wi-night-rain"
                }
        },
        "55":{
                "day":{
                        "description":"Heavy Drizzle",
-                       "image":"http://openweathermap.org/img/wn/09d@2x.png"
+                       "image":"wi-day-rain"
                },
                "night":{
                        "description":"Heavy Drizzle",
-                       "image":"http://openweathermap.org/img/wn/09n@2x.png"
+                       "image":"wi-night-rain"
                }
        },
        "56":{
                "day":{
                        "description":"Light Freezing Drizzle",
-                       "image":"http://openweathermap.org/img/wn/09d@2x.png"
+                       "image":"wi-day-rain"
                },
                "night":{
                        "description":"Light Freezing Drizzle",
-                       "image":"http://openweathermap.org/img/wn/09n@2x.png"
+                       "image":"wi-night-rain"
                }
        },
        "57":{
                "day":{
                        "description":"Freezing Drizzle",
-                       "image":"http://openweathermap.org/img/wn/09d@2x.png"
+                       "image":"wi-day-rain"
                },
                "night":{
                        "description":"Freezing Drizzle",
-                       "image":"http://openweathermap.org/img/wn/09n@2x.png"
+                       "image":"wi-night-rain"
                }
        },
        "61":{
                "day":{
                        "description":"Light Rain",
-                       "image":"http://openweathermap.org/img/wn/10d@2x.png"
+                       "image":"wi-day-rain"
                },
                "night":{
                        "description":"Light Rain",
-                       "image":"http://openweathermap.org/img/wn/10n@2x.png"
+                       "image":"wi-night-rain"
                }
        },
        "63":{
                "day":{
                        "description":"Rain",
-                       "image":"http://openweathermap.org/img/wn/10d@2x.png"
+                       "image":"wi-day-rain"
                },
                "night":{
                        "description":"Rain",
-                       "image":"http://openweathermap.org/img/wn/10n@2x.png"
+                       "image":"wi-night-rain"
                }
        },
        "65":{
                "day":{
                        "description":"Heavy Rain",
-                       "image":"http://openweathermap.org/img/wn/10d@2x.png"
+                       "image":"wi-day-rain"
                },
                "night":{
                        "description":"Heavy Rain",
-                       "image":"http://openweathermap.org/img/wn/10n@2x.png"
+                       "image":"wi-night-rain"
                }
        },
        "66":{
                "day":{
                        "description":"Light Freezing Rain",
-                       "image":"http://openweathermap.org/img/wn/10d@2x.png"
+                       "image":"wi-day-rain"
                },
                "night":{
                        "description":"Light Freezing Rain",
-                       "image":"http://openweathermap.org/img/wn/10n@2x.png"
+                       "image":"wi-night-rain"
                }
        },
        "67":{
                "day":{
                        "description":"Freezing Rain",
-                       "image":"http://openweathermap.org/img/wn/10d@2x.png"
+                       "image":"wi-day-rain"
                },
                "night":{
                        "description":"Freezing Rain",
-                       "image":"http://openweathermap.org/img/wn/10n@2x.png"
+                       "image":"wi-night-rain"
                }
        },
        "71":{
                "day":{
                        "description":"Light Snow",
-                       "image":"http://openweathermap.org/img/wn/13d@2x.png"
+                       "image":"wi-day-snow"
                },
                "night":{
                        "description":"Light Snow",
-                       "image":"http://openweathermap.org/img/wn/13n@2x.png"
+                       "image":"wi-night-snow"
                }
        },
        "73":{
                "day":{
                        "description":"Snow",
-                       "image":"http://openweathermap.org/img/wn/13d@2x.png"
+                       "image":"wi-day-snow"
                },
                "night":{
                        "description":"Snow",
-                       "image":"http://openweathermap.org/img/wn/13n@2x.png"
+                       "image":"wi-night-snow"
                }
        },
        "75":{
                "day":{
                        "description":"Heavy Snow",
-                       "image":"http://openweathermap.org/img/wn/13d@2x.png"
+                       "image":"wi-day-snow"
                },
                "night":{
                        "description":"Heavy Snow",
-                       "image":"http://openweathermap.org/img/wn/13n@2x.png"
+                       "image":"wi-night-snow"
                }
        },
        "77":{
                "day":{
                        "description":"Snow Grains",
-                       "image":"http://openweathermap.org/img/wn/13d@2x.png"
+                       "image":"wi-day-snow"
                },
                "night":{
                        "description":"Snow Grains",
-                       "image":"http://openweathermap.org/img/wn/13n@2x.png"
+                       "image":"wi-night-snow"
                }
        },
        "80":{
                "day":{
                        "description":"Light Showers",
-                       "image":"http://openweathermap.org/img/wn/09d@2x.png"
+                       "image":"wi-day-rain"
                },
                "night":{
                        "description":"Light Showers",
-                       "image":"http://openweathermap.org/img/wn/09n@2x.png"
+                       "image":"wi-night-rain"
                }
        },
        "81":{
                "day":{
                        "description":"Showers",
-                       "image":"http://openweathermap.org/img/wn/09d@2x.png"
+                       "image":"wi-day-rain"
                },
                "night":{
                        "description":"Showers",
-                       "image":"http://openweathermap.org/img/wn/09n@2x.png"
+                       "image":"wi-night-rain"
                }
        },
        "82":{
                "day":{
                        "description":"Heavy Showers",
-                       "image":"http://openweathermap.org/img/wn/09d@2x.png"
+                       "image":"wi-day-rain"
                },
                "night":{
                        "description":"Heavy Showers",
-                       "image":"http://openweathermap.org/img/wn/09n@2x.png"
+                       "image":"wi-night-rain"
                }
        },
        "85":{
                "day":{
                        "description":"Light Snow Showers",
-                       "image":"http://openweathermap.org/img/wn/13d@2x.png"
+                       "image":"wi-day-snow"
                },
                "night":{
                        "description":"Light Snow Showers",
-                       "image":"http://openweathermap.org/img/wn/13n@2x.png"
+                       "image":"wi-night-snow"
                }
        },
        "86":{
                "day":{
                        "description":"Snow Showers",
-                       "image":"http://openweathermap.org/img/wn/13d@2x.png"
+                       "image":"wi-day-snow"
                },
                "night":{
                        "description":"Snow Showers",
-                       "image":"http://openweathermap.org/img/wn/13n@2x.png"
+                       "image":"wi-night-snow"
                }
        },
        "95":{
                "day":{
                        "description":"Thunderstorm",
-                       "image":"http://openweathermap.org/img/wn/11d@2x.png"
+                       "image":"wi-day-thunderstorm"
                },
                "night":{
                        "description":"Thunderstorm",
-                       "image":"http://openweathermap.org/img/wn/11n@2x.png"
+                       "image":"wi-night-thunderstorm"
                }
        },
        "96":{
                "day":{
                        "description":"Light Thunderstorms With Hail",
-                       "image":"http://openweathermap.org/img/wn/11d@2x.png"
+                       "image":"wi-day-thunderstorm"
                },
                "night":{
                        "description":"Light Thunderstorms With Hail",
-                       "image":"http://openweathermap.org/img/wn/11n@2x.png"
+                       "image":"wi-night-thunderstorm"
                }
        },
        "99":{
                "day":{
                        "description":"Thunderstorm With Hail",
-                       "image":"http://openweathermap.org/img/wn/11d@2x.png"
+                       "image":"wi-day-thunderstorm"
                },
                "night":{
                        "description":"Thunderstorm With Hail",
-                       "image":"http://openweathermap.org/img/wn/11n@2x.png"
+                       "image":"wi-night-thunderstorm"
                }
        }
-}
\ No newline at end of file
+}
index 049932497977ad1baf75b1765e4dfc020d735f58..74af5eab07c0cfe843b66ba6f805553cab74a124 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,6 +1,7 @@
 <?php
        echo "<html>\n";
        echo "<head>\n";
+       echo "<link rel=\"stylesheet\" href=\"weather-icons/css/weather-icons.min.css\">";
        echo "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n";
        echo "<title>Weather in Park Ridge</title>\n";
        echo "</head>\n";
@@ -14,7 +15,7 @@
        $isDay = ($json["current"]["is_day"]) ? "day" : "night";
        $description = $jsonDescriptions[$code][$isDay]["description"];
        $image = $jsonDescriptions[$code][$isDay]["image"];
-       echo "<img src=\"".$image."\"/><br>".$description."<br>".floor($json["current"]["temperature_2m"])."&deg; F\n";
+       echo "<i class=\"wi ".$image."\"></i><br>".$description."<br>".floor($json["current"]["temperature_2m"])."&deg; F\n";
        echo "</h1>\n";
        echo "<h3>Your 7 day forecast for Park Ridge is:</h3>\n";
        for ($i = 0; $i < 7; $i++) {
@@ -28,7 +29,7 @@
                $precipSum = $json["daily"]["precipitation_sum"][$i];
                echo "<div style=\"min-width: 12%; display: inline-block;\">\n";
                echo "<h3>\n";
-               echo "".date('l', strtotime($json["daily"]["time"][$i]))."<br><img src=\"".$image."\"/>\n";
+               echo "".date('l', strtotime($json["daily"]["time"][$i]))."<br><i class=\"wi ".$image."\"></i>\n";
                echo "</h3>\n";
                echo "<span style=\"font-weight: bold;\">".$description."</span><br>\n";
                echo "<span style=\"font-weight: bold;\">High: </span>".$tempHigh."&deg; F\n";
@@ -42,6 +43,8 @@
        }
     echo "<br><br>\n";
     echo "<a href=\"https://open-meteo.com/\">Weather data by Open-Meteo.com</a>\n";
+    echo "<br>\n";
+    echo "<a href=\"https://github.com/erikflowers/weather-icons/\">Icons by Erik Flowers</a>\n";
        echo "</body>\n";
        echo "</html>\n";
 ?>
diff --git a/weather-icons b/weather-icons
new file mode 160000 (submodule)
index 0000000..bb80982
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit bb80982bf1f43f2d57f9dd753e7413bf88beb9ed