A clock widget for modelines with real-time sky color and moonphase/weather icon
その時刻の空の色と月齢・天気を反映したモードライン用時計
Sunrise/sunset time and moonphase are estimated from your location (latitude).
Weather (either raining, snowing or not), cloudiness and temperature are (optionally) fetched via Openweathermap API.
A cold morning.
A sunny noon.
A warm evening.
Sunset.
After sunset.
A night.
A warm rainy day with a few clouds.
A cold cloudy snowy day.
Put sky-color-clock.el in a “load-path”ed directory, require this script
(require 'sky-color-clock)
and initialize sky-color-clock with your location’s latitude
(sky-color-clock-initialize 35) ; Tokyo, Japan
Then function sky-color-clock
returns a propertized string, which
you may add to your mode-line-format
.
(push '(:eval (sky-color-clock)) (default-value 'mode-line-format))
You also may give sky-color-clock a Openweathermap API key
(sky-color-clock-initialize-openweathermap-client "API-Key" 1850144) ; Tokyo's City ID
to enable weather icon (rain or snow), tmperature indicator and reflect cloudiness to the sky color.
You may change time format with sky-color-clock-format
(setq sky-color-clock-format "%d %H:%M")
which is internally passed to format-time-string
function.
Background color changes over the time, with respect to the sunset / sunrise time of the day at your location.
Sunset / sunrise time are estimated from your location’s latitude,
which you passed to sky-color-clock-initialize
.
(sky-color-clock-initialize 35) ; Tokyo, Japan
Color samples:
Moonphase icon is displayed with an unicode emoji, if
sky-color-clock-enable-emoji-icon
is non-nil.
(setq sky-color-clock-enable-emoji-icon t)
When an openweathermap API key and a city ID is passed to
sky-color-clock with
sky-color-clock-initialize-openweathermap-client
,
(sky-color-clock-initialize-openweathermap-client "API-key" 1850144)
sky-color-clock fetches the current weather (at the specified city) every 30 minutes, and following features are enabled in addition.
Reflect cloudiness (0%-100%) at the time, to the background sky color.
Adds a temperature indicator to the right of the clock, which indicates temperature at the time with a color.
0[C] - 15[C] - 30[C]
You can disable this feature with
sky-color-clock-enable-temperature-indicator
.
(setq sky-color-clock-enable-temperature-indicator nil)
A rain / snow emoji is displayed instead of the moonphase icon, if it’s raining or snowing.
You need to enable the moonphase icon feature to enable this feature.