Better HN
topnewbestaskshowjobs
Log inSign up

temp0198209812

4 karma · joined Apr 11, 2018 (8y ago) · 1 submissions

Submissions

comment 8y ago · link · parent

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))