solarized-theme.el (2029B)
1 ;; solarized-theme.el --- Solarized custom theme -*- lexical-binding: t; -*- 2 3 (require 'solarized-definitions 4 (locate-file "solarized-definitions.el" custom-theme-load-path 5 '("c" ""))) 6 7 (deftheme solarized solarized-description) 8 9 (apply #'custom-theme-set-faces 'solarized (solarized-color-definitions)) 10 11 (custom-theme-set-variables 12 'solarized 13 ;; This is obsolete, but something might still be referencing it. 14 `(ansi-color-names-vector 15 ,(apply #'vector 16 (mapcar (lambda (color-name) 17 (nth 1 (assoc color-name solarized-colors))) 18 '(base02 red green yellow blue magenta cyan base2))))) 19 20 (cl-defun solarized-update-background-mode 21 (appearance &optional (frames (frame-list))) 22 "Set the APPEARANCE of all frames to either 'light or 'dark. 23 This is not specific to Solarized – it will update the appearance of any theme 24 that observes the background characteristic." 25 (setq frame-background-mode appearance) 26 (mapc #'frame-set-background-mode frames) 27 ;; Supposedly #'frame-set-background-mode updates the faces, but it doesn’t 28 ;; seem to actually., so re-enable all the themes. 29 (mapc #'enable-theme (reverse custom-enabled-themes)) 30 ;; For some reason, ‘enable-theme’ (or maybe ‘solarized’?) is resetting the 31 ;; ‘frame-background-mode’, so reset it here. 32 (setq frame-background-mode appearance)) 33 34 (defun solarized-toggle-background-mode () 35 "Toggle between light and dark background modes. 36 This is not specific to Solarized – it will update the appearance of any theme 37 that observes the background characteristic." 38 (interactive) 39 (let ((new-mode (pcase frame-background-mode 40 ('dark 'light) 41 (_ 'dark)))) 42 (solarized-update-background-mode new-mode))) 43 44 ;;;###autoload 45 (when load-file-name 46 (add-to-list 'custom-theme-load-path 47 (file-name-as-directory (file-name-directory load-file-name)))) 48 49 (provide-theme 'solarized) 50 ;;; solarized-theme.el ends here