Goto navigation

Weather-dependent stylesheet

your preference:
On cweiske.de you can see the first weather-dependent stylesheet:
If it rains in Leipzig (my home), the page is blue. If it snows, it is white. If there is hot sun, the page is orange!
And if the sun is down, the page is dark ;)

There are 5 states:

How it works:
Every 15 minutes, the weathersheet-script is started and the time of sunrise and sunset is calculated (relative to Leipzig/Germany). If the current time (here in Leipzig) is past sunset and before sunraise, the night stylesheet is selected.
Elsewhere the current month is taken: in winter, the snow-sheet, in spring the green springsheet and in summer the orange sheet is picked (This is just to have a roughly good estimation how the weather could be if the weather page is down).
After this, an internet weather page is grabbed and the weather information for Leipzig at the current time is extracted. When it's raining, the blue sheet is taken, with sun the orange one is chosen. In the case of clouds, the spring sheet is picked and if there is snow, the white stylesheet is selected.
Now, the chosen stylesheet is saved and will be used on the page for the next 15 minutes.

I came on that idea at university; I told my friends that I did the spring sheet (because it was spring), and one of them said: "Why not make the sheet weather dependant?" I first laughed on this, but it didn't want to go out of my mind... And so I wrote the script.


If you don't want the weather- and time-dependent stylesheet, you can set your preference top right corner of this page
Navigation
File: home_stylesheet.htm | last update: 2014-10-30 23:00:08 Valid XHTML Valid CSS