3 ms·
You can leverage the existing sunrise-sunset function to determine if it is day on night and change your theme accordingly. (defun daytime? () (sunrise-sunse
by temp0198209812 9y ago
You can leverage the existing sunrise-sunset function to determine if it is day on night and change your theme accordingly.
(defun daytime? ()
(sunrise-sunset)
(let ((range (mapcar 'car (butlast (solar-sunrise-sunset (calendar-current-date))))))
(let ((sunrise (car range))
(sunset (cadr range))
(now (string-to-number (format-time-string "%H"))))
(< sunrise now sunset))))
(if (daytime?) (light) (dark))