GitHub - zk-phi/sky-color-clock: [Emacs] A clock widget for modeline with sky co...
source link: https://github.com/zk-phi/sky-color-clock
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
sky-color-clock.el
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.
Screenshots
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.
Installation
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.
Features / Customization
Time Format
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 Colors
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
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)
Openweathermap Integration
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.
Cloudy Colors
Reflect cloudiness (0%-100%) at the time, to the background sky color.
Temperature Indicator
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)
Rain / Snow Icon
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.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK