From 935f17c86581a4274958778999f59895abd6b293 Mon Sep 17 00:00:00 2001 From: Stephen Jianu Date: Sun, 30 Mar 2025 15:24:28 -0500 Subject: [PATCH] Implement rudimentary theme support For the time being, themes must be defined by specifying the name in the "theme" URL parameter. If no path to a subdirectory under the "themes" directory is defined, the script will assume the user meant to choose a theme in "themes/base16-styles/css". The default theme is "base16-default-dark". --- .gitmodules | 3 +++ Dockerfile | 1 + README.md | 1 + index.php | 13 +++++++++---- themes/base16-styles | 1 + 5 files changed, 15 insertions(+), 4 deletions(-) create mode 160000 themes/base16-styles diff --git a/.gitmodules b/.gitmodules index ea9d4d5..92729fa 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "weather-icons"] path = weather-icons url = https://github.com/erikflowers/weather-icons +[submodule "themes/base16-styles"] + path = themes/base16-styles + url = https://github.com/samme/base16-styles diff --git a/Dockerfile b/Dockerfile index d5b5bbb..fcf7d22 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,3 +4,4 @@ COPY ./.htaccess /var/www/html COPY ./descriptions.json /var/www/html COPY ./index.php /var/www/html COPY ./weather-icons /var/www/html/weather-icons +COPY ./themes /var/www/html/themes diff --git a/README.md b/README.md index 78cc4ef..2d5f1af 100644 --- a/README.md +++ b/README.md @@ -17,3 +17,4 @@ docker run -d -p 6969:80 --restart=unless-stopped --name reasonableweather regis * [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/) +* [base16-styles CSS themes](https://github.com/samme/base16-styles) diff --git a/index.php b/index.php index 97cd304..ba155d4 100644 --- a/index.php +++ b/index.php @@ -1,11 +1,16 @@ \n"; echo "\n"; - echo ""; + echo ""; + if (str_contains($theme, '/')) + echo ""; + else + echo ""; echo "\n"; echo "Weather in Park Ridge\n"; echo "\n"; - echo "\n"; + echo "\n"; echo "

The current conditions in Park Ridge are:

\n"; echo "

\n"; $url = "https://api.open-meteo.com/v1/forecast?latitude=42.0111&longitude=-87.8406&daily=temperature_2m_max,temperature_2m_min,weather_code,wind_speed_10m_max,precipitation_probability_max,precipitation_sum¤t=temperature_2m,weather_code,is_day,&timezone=America%2FChicago&wind_speed_unit=mph&temperature_unit=fahrenheit&precipitation_unit=inch"; @@ -42,9 +47,9 @@ echo "\n"; } echo "

\n"; - echo "Weather data by Open-Meteo.com\n"; + echo "Weather data by Open-Meteo.com\n"; echo "
\n"; - echo "Icons by Erik Flowers\n"; + echo "Icons by Erik Flowers\n"; echo "\n"; echo "\n"; ?> diff --git a/themes/base16-styles b/themes/base16-styles new file mode 160000 index 0000000..8db4f00 --- /dev/null +++ b/themes/base16-styles @@ -0,0 +1 @@ +Subproject commit 8db4f00ca9e5575ba52d98a204ee44a53e13d546 -- 2.39.5