2015-01-27 03:51:47 +00:00
|
|
|
;;; core-themes-support.el --- Spacemacs Core File
|
2015-01-14 04:12:56 +00:00
|
|
|
;;
|
2018-01-04 07:00:25 +00:00
|
|
|
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
|
2015-01-14 04:12:56 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
2016-01-23 13:40:24 +00:00
|
|
|
(defconst emacs-built-in-themes (cons 'default (custom-available-themes))
|
2015-04-14 19:50:29 +00:00
|
|
|
"List of emacs built-in themes")
|
|
|
|
|
2017-01-25 05:30:31 +00:00
|
|
|
(defvar spacemacs--fallback-theme 'spacemacs-dark
|
|
|
|
"Fallback theme if user theme cannot be applied.")
|
|
|
|
|
2017-01-26 04:30:25 +00:00
|
|
|
(defvar spacemacs--delayed-user-theme nil
|
2017-01-25 05:30:31 +00:00
|
|
|
"Internal variable storing user theme to be installed.")
|
|
|
|
|
2017-10-21 12:33:12 +00:00
|
|
|
(defvar spacemacs--cur-theme nil
|
|
|
|
"Internal variable storing currently loaded theme.")
|
|
|
|
|
2015-06-09 05:31:29 +00:00
|
|
|
(defface org-kbd
|
|
|
|
'((t (:background "LemonChiffon1" :foreground "black" :box
|
2015-06-10 05:32:44 +00:00
|
|
|
(:line-width 2 :color nil :style released-button))))
|
2015-06-09 05:31:29 +00:00
|
|
|
"Face for displaying key bindings in Spacemacs documents."
|
|
|
|
:group 'org-faces)
|
|
|
|
|
2015-01-24 03:02:08 +00:00
|
|
|
(defconst spacemacs-theme-name-to-package
|
2015-01-14 03:14:48 +00:00
|
|
|
'(
|
2017-01-04 20:12:14 +00:00
|
|
|
(alect-black . alect-themes)
|
2020-07-21 21:29:13 +00:00
|
|
|
(alect-black-alt . alect-themes)
|
2017-01-04 20:12:14 +00:00
|
|
|
(alect-dark . alect-themes)
|
2020-07-21 21:29:13 +00:00
|
|
|
(alect-dark-alt . alect-themes)
|
2017-01-04 20:12:14 +00:00
|
|
|
(alect-light . alect-themes)
|
2020-07-21 21:29:13 +00:00
|
|
|
(alect-light-alt . alect-themes)
|
2020-07-20 08:06:24 +00:00
|
|
|
(almost-mono-black . almost-mono-themes)
|
|
|
|
(almost-mono-cream . almost-mono-themes)
|
|
|
|
(almost-mono-gray . almost-mono-themes)
|
2020-07-21 21:29:13 +00:00
|
|
|
(almost-mono-white . almost-mono-themes)
|
2017-01-04 20:12:14 +00:00
|
|
|
(ample-flat . ample-theme)
|
2020-07-21 21:29:13 +00:00
|
|
|
(ample-light . ample-theme)
|
2017-01-04 20:12:14 +00:00
|
|
|
(apropospriate-dark . apropospriate-theme)
|
2020-07-21 21:29:13 +00:00
|
|
|
(apropospriate-light . apropospriate-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-3024 . base16-theme)
|
|
|
|
(base16-apathy . base16-theme)
|
|
|
|
(base16-ashes . base16-theme)
|
|
|
|
(base16-atelier-cave . base16-theme)
|
2020-07-21 21:29:13 +00:00
|
|
|
(base16-atelier-cave-light . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-atelier-dune . base16-theme)
|
2020-07-21 21:29:13 +00:00
|
|
|
(base16-atelier-dune-light . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-atelier-estuary . base16-theme)
|
2020-07-21 21:29:13 +00:00
|
|
|
(base16-atelier-estuary-light . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-atelier-forest . base16-theme)
|
2020-07-21 21:29:13 +00:00
|
|
|
(base16-atelier-forest-light . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-atelier-heath . base16-theme)
|
2020-07-21 21:29:13 +00:00
|
|
|
(base16-atelier-heath-light . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-atelier-lakeside . base16-theme)
|
2020-07-21 21:29:13 +00:00
|
|
|
(base16-atelier-lakeside-light . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-atelier-plateau . base16-theme)
|
2020-07-21 21:29:13 +00:00
|
|
|
(base16-atelier-plateau-light . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-atelier-savanna . base16-theme)
|
2020-07-21 21:29:13 +00:00
|
|
|
(base16-atelier-savanna-light . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-atelier-seaside . base16-theme)
|
2020-07-21 21:29:13 +00:00
|
|
|
(base16-atelier-seaside-light . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-atelier-sulphurpool . base16-theme)
|
2020-07-21 21:29:13 +00:00
|
|
|
(base16-atelier-sulphurpool-light . base16-theme)
|
2019-07-17 19:13:49 +00:00
|
|
|
(base16-atlas . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-bespin . base16-theme)
|
2019-07-17 19:13:49 +00:00
|
|
|
(base16-black-metal . base16-theme)
|
|
|
|
(base16-black-metal-bathory . base16-theme)
|
|
|
|
(base16-black-metal-burzum . base16-theme)
|
|
|
|
(base16-black-metal-dark-funeral . base16-theme)
|
|
|
|
(base16-black-metal-gorgoroth . base16-theme)
|
|
|
|
(base16-black-metal-immortal . base16-theme)
|
|
|
|
(base16-black-metal-khold . base16-theme)
|
|
|
|
(base16-black-metal-marduk . base16-theme)
|
|
|
|
(base16-black-metal-mayhem . base16-theme)
|
|
|
|
(base16-black-metal-nile . base16-theme)
|
|
|
|
(base16-black-metal-venom . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-brewer . base16-theme)
|
|
|
|
(base16-bright . base16-theme)
|
2019-07-17 19:13:49 +00:00
|
|
|
(base16-brogrammer . base16-theme)
|
2018-01-18 23:36:58 +00:00
|
|
|
(base16-brushtrees . base16-theme)
|
|
|
|
(base16-brushtrees-dark . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-chalk . base16-theme)
|
2018-01-18 23:36:58 +00:00
|
|
|
(base16-circus . base16-theme)
|
|
|
|
(base16-classic-dark . base16-theme)
|
|
|
|
(base16-classic-light . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-codeschool . base16-theme)
|
|
|
|
(base16-cupcake . base16-theme)
|
2018-01-18 23:36:58 +00:00
|
|
|
(base16-cupertino . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-darktooth . base16-theme)
|
|
|
|
(base16-default-dark . base16-theme)
|
|
|
|
(base16-default-light . base16-theme)
|
|
|
|
(base16-dracula . base16-theme)
|
|
|
|
(base16-eighties . base16-theme)
|
|
|
|
(base16-embers . base16-theme)
|
|
|
|
(base16-flat . base16-theme)
|
2019-07-17 19:13:49 +00:00
|
|
|
(base16-fruit-soda . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-github . base16-theme)
|
|
|
|
(base16-google-dark . base16-theme)
|
|
|
|
(base16-google-light . base16-theme)
|
|
|
|
(base16-grayscale-dark . base16-theme)
|
|
|
|
(base16-grayscale-light . base16-theme)
|
2018-01-18 23:36:58 +00:00
|
|
|
(base16-greenscreen . base16-theme)
|
|
|
|
(base16-gruvbox-dark-hard . base16-theme)
|
|
|
|
(base16-gruvbox-dark-medium . base16-theme)
|
|
|
|
(base16-gruvbox-dark-pale . base16-theme)
|
|
|
|
(base16-gruvbox-dark-soft . base16-theme)
|
|
|
|
(base16-gruvbox-light-hard . base16-theme)
|
|
|
|
(base16-gruvbox-light-medium . base16-theme)
|
|
|
|
(base16-gruvbox-light-soft . base16-theme)
|
|
|
|
(base16-harmonic-dark . base16-theme)
|
|
|
|
(base16-harmonic-light . base16-theme)
|
2019-07-17 19:13:49 +00:00
|
|
|
(base16-heetch . base16-theme)
|
|
|
|
(base16-heetch-light . base16-theme)
|
|
|
|
(base16-helios . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-hopscotch . base16-theme)
|
2019-07-17 19:13:49 +00:00
|
|
|
(base16-horizon-dark . base16-theme)
|
|
|
|
(base16-ia-dark . base16-theme)
|
|
|
|
(base16-ia-light . base16-theme)
|
|
|
|
(base16-icy . base16-theme)
|
2018-01-18 23:36:58 +00:00
|
|
|
(base16-irblack . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-isotope . base16-theme)
|
|
|
|
(base16-macintosh . base16-theme)
|
|
|
|
(base16-marrakesh . base16-theme)
|
|
|
|
(base16-materia . base16-theme)
|
2020-07-21 21:29:13 +00:00
|
|
|
(base16-material . base16-theme)
|
2018-01-18 23:36:58 +00:00
|
|
|
(base16-material-darker . base16-theme)
|
|
|
|
(base16-material-lighter . base16-theme)
|
|
|
|
(base16-material-palenight . base16-theme)
|
|
|
|
(base16-mellow-purple . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-mexico-light . base16-theme)
|
|
|
|
(base16-mocha . base16-theme)
|
|
|
|
(base16-monokai . base16-theme)
|
2018-01-18 23:36:58 +00:00
|
|
|
(base16-nord . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-ocean . base16-theme)
|
|
|
|
(base16-oceanicnext . base16-theme)
|
2019-07-17 19:13:49 +00:00
|
|
|
(base16-one-light . base16-theme)
|
2020-07-21 21:29:13 +00:00
|
|
|
(base16-one-light . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-onedark . base16-theme)
|
2019-07-17 19:13:49 +00:00
|
|
|
(base16-outrun-dark . base16-theme)
|
|
|
|
(base16-papercolor-dark . base16-theme)
|
|
|
|
(base16-papercolor-light . base16-theme)
|
|
|
|
(base16-paraiso . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-paraiso . base16-theme)
|
|
|
|
(base16-phd . base16-theme)
|
|
|
|
(base16-pico . base16-theme)
|
|
|
|
(base16-pop . base16-theme)
|
2018-01-18 23:36:58 +00:00
|
|
|
(base16-porple . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-railscasts . base16-theme)
|
|
|
|
(base16-rebecca . base16-theme)
|
|
|
|
(base16-seti . base16-theme)
|
|
|
|
(base16-shapeshifter . base16-theme)
|
2019-07-17 19:13:49 +00:00
|
|
|
(base16-snazzy . base16-theme)
|
2017-07-06 06:48:39 +00:00
|
|
|
(base16-solarflare . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-solarized-dark . base16-theme)
|
|
|
|
(base16-solarized-light . base16-theme)
|
|
|
|
(base16-spacemacs . base16-theme)
|
|
|
|
(base16-summerfruit-dark . base16-theme)
|
|
|
|
(base16-summerfruit-light . base16-theme)
|
2019-07-17 19:13:49 +00:00
|
|
|
(base16-synth-midnight-dark . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-tomorrow . base16-theme)
|
2020-07-21 21:29:13 +00:00
|
|
|
(base16-tomorrow-night . base16-theme)
|
2017-01-01 00:02:56 +00:00
|
|
|
(base16-tube . base16-theme)
|
|
|
|
(base16-twilight . base16-theme)
|
|
|
|
(base16-unikitty-dark . base16-theme)
|
|
|
|
(base16-unikitty-light . base16-theme)
|
|
|
|
(base16-woodland . base16-theme)
|
2018-01-18 23:36:58 +00:00
|
|
|
(base16-xcode-dusk . base16-theme)
|
|
|
|
(base16-zenburn . base16-theme)
|
2020-07-21 21:29:13 +00:00
|
|
|
(brin . sublime-themes)
|
|
|
|
(colorsarenice-dark . colorsarenice-theme)
|
|
|
|
(colorsarenice-light . colorsarenice-theme)
|
2019-08-21 13:40:33 +00:00
|
|
|
(doom-Iosvkem . doom-themes)
|
2020-02-09 18:30:35 +00:00
|
|
|
(doom-acario-dark . doom-themes)
|
|
|
|
(doom-acario-light . doom-themes)
|
2018-07-06 20:32:36 +00:00
|
|
|
(doom-challenger-deep . doom-themes)
|
2018-05-14 21:57:44 +00:00
|
|
|
(doom-city-lights . doom-themes)
|
2020-01-23 10:00:21 +00:00
|
|
|
(doom-dark+ . doom-themes)
|
2018-05-14 21:57:44 +00:00
|
|
|
(doom-dracula . doom-themes)
|
2020-03-02 17:26:13 +00:00
|
|
|
(doom-ephemeral . doom-themes)
|
2019-08-21 13:40:33 +00:00
|
|
|
(doom-fairy-floss . doom-themes)
|
|
|
|
(doom-gruvbox . doom-themes)
|
2020-06-05 11:24:41 +00:00
|
|
|
(doom-gruvbox-light . doom-themes)
|
2020-02-09 18:30:35 +00:00
|
|
|
(doom-horizon . doom-themes)
|
|
|
|
(doom-laserwave . doom-themes)
|
|
|
|
(doom-manegarm . doom-themes)
|
|
|
|
(doom-material . doom-themes)
|
2020-03-13 15:56:43 +00:00
|
|
|
(doom-molokai . doom-themes)
|
2020-03-13 02:17:10 +00:00
|
|
|
(doom-monokai-classic . doom-themes)
|
2020-03-14 07:02:34 +00:00
|
|
|
(doom-monokai-pro . doom-themes)
|
2019-08-21 13:40:33 +00:00
|
|
|
(doom-moonlight . doom-themes)
|
2018-05-14 21:57:44 +00:00
|
|
|
(doom-nord . doom-themes)
|
|
|
|
(doom-nord-light . doom-themes)
|
2017-06-13 17:15:04 +00:00
|
|
|
(doom-nova . doom-themes)
|
2020-02-09 18:30:35 +00:00
|
|
|
(doom-oceanic-next . doom-themes)
|
2017-06-13 17:15:04 +00:00
|
|
|
(doom-one . doom-themes)
|
|
|
|
(doom-one-light . doom-themes)
|
2018-07-06 20:32:36 +00:00
|
|
|
(doom-opera . doom-themes)
|
|
|
|
(doom-opera-light . doom-themes)
|
2019-08-21 13:40:33 +00:00
|
|
|
(doom-outrun-electric . doom-themes)
|
|
|
|
(doom-palenight . doom-themes)
|
2017-06-13 17:15:04 +00:00
|
|
|
(doom-peacock . doom-themes)
|
2019-08-21 13:40:33 +00:00
|
|
|
(doom-snazzy . doom-themes)
|
|
|
|
(doom-solarized-dark . doom-themes)
|
2018-07-06 20:32:36 +00:00
|
|
|
(doom-solarized-light . doom-themes)
|
2019-08-21 13:40:33 +00:00
|
|
|
(doom-sourcerer . doom-themes)
|
|
|
|
(doom-spacegrey . doom-themes)
|
2017-06-13 17:15:04 +00:00
|
|
|
(doom-tomorrow-day . doom-themes)
|
|
|
|
(doom-tomorrow-night . doom-themes)
|
|
|
|
(doom-vibrant . doom-themes)
|
2019-08-21 13:40:33 +00:00
|
|
|
(doom-wilmersdorf . doom-themes)
|
2017-01-04 20:12:14 +00:00
|
|
|
(dorsey . sublime-themes)
|
2020-07-21 21:29:13 +00:00
|
|
|
(eziam-dark . eziam-theme)
|
|
|
|
(eziam-dusk . eziam-theme)
|
|
|
|
(eziam-light . eziam-theme)
|
|
|
|
(farmhouse-dark . farmhouse-theme)
|
|
|
|
(farmhouse-light . farmhouse-theme)
|
2017-01-04 20:12:14 +00:00
|
|
|
(fogus . sublime-themes)
|
|
|
|
(graham . sublime-themes)
|
|
|
|
(granger . sublime-themes)
|
2017-10-13 22:57:53 +00:00
|
|
|
(gruvbox-dark-hard . gruvbox-theme)
|
2020-07-21 21:29:13 +00:00
|
|
|
(gruvbox-dark-medium . gruvbox-theme)
|
|
|
|
(gruvbox-dark-soft . gruvbox-theme)
|
2017-10-13 22:57:53 +00:00
|
|
|
(gruvbox-light-hard . gruvbox-theme)
|
2020-07-21 21:29:13 +00:00
|
|
|
(gruvbox-light-medium . gruvbox-theme)
|
|
|
|
(gruvbox-light-soft . gruvbox-theme)
|
|
|
|
(hemisu-dark . hemisu-theme)
|
|
|
|
(hemisu-light . hemisu-theme)
|
|
|
|
(hickey . sublime-themes)
|
|
|
|
(junio . sublime-themes)
|
2019-05-29 06:59:47 +00:00
|
|
|
(kaolin-aurora . kaolin-themes)
|
|
|
|
(kaolin-breeze . kaolin-themes)
|
|
|
|
(kaolin-bubblegum . kaolin-themes)
|
2020-07-21 21:29:13 +00:00
|
|
|
(kaolin-dark . kaolin-themes)
|
2018-05-03 16:10:34 +00:00
|
|
|
(kaolin-eclipse . kaolin-themes)
|
|
|
|
(kaolin-galaxy . kaolin-themes)
|
2020-07-21 21:29:13 +00:00
|
|
|
(kaolin-light . kaolin-themes)
|
2018-05-03 16:10:34 +00:00
|
|
|
(kaolin-mono-dark . kaolin-themes)
|
2019-05-29 06:59:47 +00:00
|
|
|
(kaolin-ocean . kaolin-themes)
|
|
|
|
(kaolin-temple . kaolin-themes)
|
|
|
|
(kaolin-valley-dark . kaolin-themes)
|
|
|
|
(kaolin-valley-light . kaolin-themes)
|
2020-07-21 21:29:13 +00:00
|
|
|
(majapahit-dark . majapahit-theme)
|
|
|
|
(majapahit-light . majapahit-theme)
|
|
|
|
(material-light . material-theme)
|
|
|
|
(mccarthy . sublime-themes)
|
|
|
|
(minimal-light . minimal-theme)
|
|
|
|
(modus-operandi . modus-operandi-theme)
|
|
|
|
(modus-vivendi . modus-vivendi-theme)
|
|
|
|
(moe-dark . moe-theme)
|
|
|
|
(moe-light . moe-theme)
|
|
|
|
(odersky . sublime-themes)
|
|
|
|
(omtose-darker . omtose-phellack-theme)
|
|
|
|
(omtose-softer . omtose-phellack-theme)
|
2020-05-31 20:17:03 +00:00
|
|
|
(poet-dark . poet-theme)
|
|
|
|
(poet-dark-monochrome . poet-theme)
|
2020-07-21 21:29:13 +00:00
|
|
|
(poet-monochrome . poet-theme)
|
|
|
|
(ritchie . sublime-themes)
|
|
|
|
(sanityinc-solarized-dark . color-theme-sanityinc-solarized)
|
|
|
|
(sanityinc-solarized-light . color-theme-sanityinc-solarized)
|
|
|
|
(sanityinc-tomorrow-blue . color-theme-sanityinc-tomorrow)
|
|
|
|
(sanityinc-tomorrow-bright . color-theme-sanityinc-tomorrow)
|
|
|
|
(sanityinc-tomorrow-day . color-theme-sanityinc-tomorrow)
|
|
|
|
(sanityinc-tomorrow-eighties . color-theme-sanityinc-tomorrow)
|
|
|
|
(sanityinc-tomorrow-night . color-theme-sanityinc-tomorrow)
|
|
|
|
(solarized-dark . solarized-theme)
|
|
|
|
(solarized-dark-high-contrast . solarized-theme)
|
|
|
|
(solarized-gruvbox-dark . solarized-theme)
|
|
|
|
(solarized-gruvbox-light . solarized-theme)
|
|
|
|
(solarized-light . solarized-theme)
|
|
|
|
(solarized-light-high-contrast . solarized-theme)
|
|
|
|
(solarized-wombat-dark . solarized-theme)
|
|
|
|
(solarized-zenburn . solarized-theme)
|
|
|
|
(spacemacs-dark . spacemacs-theme)
|
|
|
|
(spacemacs-light . spacemacs-theme)
|
|
|
|
(spolsky . sublime-themes)
|
|
|
|
(stekene-dark . stekene-theme)
|
|
|
|
(stekene-light . stekene-theme)
|
|
|
|
(tao-yang . tao-theme)
|
|
|
|
(tao-yin . tao-theme)
|
|
|
|
(wilson . sublime-themes)
|
|
|
|
(zonokai-blue . zonokai-theme)
|
|
|
|
(zonokai-red . zonokai-theme)
|
2015-01-14 03:14:48 +00:00
|
|
|
)
|
2015-01-24 03:02:08 +00:00
|
|
|
"alist matching a theme name with its package name, required when
|
|
|
|
package name does not match theme name + `-theme' suffix.")
|
2015-01-14 03:14:48 +00:00
|
|
|
|
2016-07-15 07:14:58 +00:00
|
|
|
(defvar spacemacs-post-theme-change-hook nil
|
|
|
|
"Hook run after theme has changed.")
|
|
|
|
|
2017-02-11 22:19:41 +00:00
|
|
|
(defun spacemacs/get-theme-package-name (theme-name)
|
2015-04-14 19:50:29 +00:00
|
|
|
"Returns the package theme for the given THEME name."
|
|
|
|
(cond
|
|
|
|
;; built-in
|
2017-02-11 22:19:41 +00:00
|
|
|
((memq theme-name emacs-built-in-themes) nil)
|
2015-04-14 19:50:29 +00:00
|
|
|
;; from explicit alist
|
2017-02-11 22:19:41 +00:00
|
|
|
((assq theme-name spacemacs-theme-name-to-package)
|
|
|
|
(cdr (assq theme-name spacemacs-theme-name-to-package)))
|
2015-04-14 19:50:29 +00:00
|
|
|
;; fallback to <name>-theme
|
2017-02-11 22:19:41 +00:00
|
|
|
(t (intern (format "%S-theme" theme-name)))))
|
2015-04-14 19:50:29 +00:00
|
|
|
|
2017-02-02 03:59:03 +00:00
|
|
|
(defun spacemacs//get-theme-name (theme)
|
|
|
|
"Return the name of THEME."
|
|
|
|
(if (listp theme)
|
|
|
|
(car theme)
|
|
|
|
theme))
|
|
|
|
|
2017-02-06 04:01:50 +00:00
|
|
|
(defun spacemacs//get-theme-package-directory (theme)
|
|
|
|
"Return the THEME location on disk."
|
|
|
|
(let* ((theme-name (spacemacs//get-theme-name theme))
|
|
|
|
(pkg-name (spacemacs/get-theme-package-name theme-name))
|
2017-02-11 22:19:41 +00:00
|
|
|
(dir (when (listp theme)
|
|
|
|
(configuration-layer/get-location-directory
|
|
|
|
pkg-name
|
|
|
|
(plist-get (cdr theme) :location)
|
|
|
|
'dotfile))))
|
2017-02-06 04:01:50 +00:00
|
|
|
(unless dir
|
|
|
|
;; fallback to elpa directory
|
|
|
|
(setq dir (configuration-layer/get-elpa-package-install-directory
|
|
|
|
pkg-name)))
|
|
|
|
dir))
|
|
|
|
|
2017-06-16 07:34:39 +00:00
|
|
|
(defun spacemacs/load-default-theme (&optional fallback-theme disable)
|
2017-02-02 03:59:03 +00:00
|
|
|
"Load default theme.
|
|
|
|
Default theme is the car of `dotspacemacs-themes'.
|
|
|
|
If FALLBACK-THEME is non-nil it must be a package name which will be loaded if
|
|
|
|
THEME cannot be applied."
|
2017-06-16 07:34:39 +00:00
|
|
|
(spacemacs/load-theme (car dotspacemacs-themes) fallback-theme disable))
|
2017-02-02 03:59:03 +00:00
|
|
|
|
2017-01-26 04:30:25 +00:00
|
|
|
(defun spacemacs/load-theme (theme &optional fallback-theme disable)
|
|
|
|
"Apply user theme.
|
|
|
|
If FALLBACK-THEME is non-nil it must be a package name which will be loaded if
|
|
|
|
THEME cannot be applied.
|
|
|
|
If DISABLE is non-nil then disable all previously applied themes before applying
|
|
|
|
THEME."
|
2017-02-02 03:59:03 +00:00
|
|
|
(let ((theme-name (spacemacs//get-theme-name theme)))
|
|
|
|
(condition-case err
|
|
|
|
(progn
|
|
|
|
;; Load theme
|
|
|
|
(unless (or (memq theme-name (custom-available-themes))
|
|
|
|
(eq 'default theme-name))
|
2017-04-25 15:23:48 +00:00
|
|
|
(let ((pkg-dir (spacemacs//get-theme-package-directory theme))
|
|
|
|
(pkg-name (spacemacs/get-theme-package-name theme-name)))
|
2017-02-02 03:59:03 +00:00
|
|
|
(when pkg-dir
|
2017-04-25 15:23:48 +00:00
|
|
|
;; package activate should be enough, but not all themes
|
|
|
|
;; have add themselves to `custom-theme-load-path' in autoload.
|
|
|
|
;; (for example, moe-theme).
|
2017-02-02 03:59:03 +00:00
|
|
|
(add-to-list 'custom-theme-load-path pkg-dir)
|
2017-04-25 15:23:48 +00:00
|
|
|
(package-activate pkg-name))))
|
2017-02-02 03:59:03 +00:00
|
|
|
(when disable
|
|
|
|
(mapc 'disable-theme custom-enabled-themes))
|
2017-06-16 07:30:32 +00:00
|
|
|
(unless (eq 'default theme-name)
|
|
|
|
(load-theme theme-name t))
|
2017-02-02 04:26:22 +00:00
|
|
|
(unless (display-graphic-p)
|
|
|
|
(eval `(spacemacs|do-after-display-system-init
|
|
|
|
(load-theme ',theme-name t))))
|
2017-10-21 12:33:12 +00:00
|
|
|
(setq-default spacemacs--cur-theme theme-name))
|
2017-02-02 03:59:03 +00:00
|
|
|
('error
|
2017-02-11 22:19:41 +00:00
|
|
|
(message "error: %s" err)
|
2017-02-02 03:59:03 +00:00
|
|
|
(if fallback-theme
|
|
|
|
;; fallback to Spacemacs default theme
|
|
|
|
(progn
|
|
|
|
(setq spacemacs--delayed-user-theme theme-name)
|
|
|
|
(spacemacs/load-fallback-theme fallback-theme disable))
|
|
|
|
;; no fallback theme was specified, so we log explicit warning
|
|
|
|
(spacemacs-buffer/warning
|
|
|
|
(concat "An error occurred while applying "
|
|
|
|
"the theme \"%s\", fallback on theme \"%s\". \n"
|
|
|
|
"Error was: %s")
|
|
|
|
theme-name spacemacs--fallback-theme err)
|
|
|
|
(spacemacs-buffer/warning
|
|
|
|
(concat "Please check the value of \"dotspacemacs-themes\" in your "
|
|
|
|
"dotfile or open an issue \n"
|
|
|
|
"so we can add support for the theme \"%s\".")
|
|
|
|
theme-name))))))
|
2017-01-26 04:30:25 +00:00
|
|
|
|
|
|
|
(defun spacemacs/load-fallback-theme (theme &optional disable)
|
|
|
|
"Apply the fallback theme.
|
|
|
|
If DISABLE is non-nil then disable all previously applied themes before applying
|
|
|
|
THEME."
|
2017-02-02 03:59:03 +00:00
|
|
|
(let ((theme-name (spacemacs//get-theme-name theme)))
|
|
|
|
;; pop up fallback theme to the top of the list
|
|
|
|
(setq spacemacs--cur-theme theme-name)
|
|
|
|
(setq dotspacemacs-themes (delq theme-name dotspacemacs-themes))
|
|
|
|
(add-to-list 'dotspacemacs-themes theme-name)
|
|
|
|
(when disable
|
|
|
|
(mapc 'disable-theme custom-enabled-themes))
|
2017-02-02 04:26:22 +00:00
|
|
|
(load-theme theme-name t)
|
|
|
|
(unless (display-graphic-p)
|
|
|
|
(eval `(spacemacs|do-after-display-system-init
|
|
|
|
(load-theme ',theme-name t))))))
|
2015-01-24 03:02:08 +00:00
|
|
|
|
2017-09-29 18:21:50 +00:00
|
|
|
(defun spacemacs/cycle-spacemacs-theme (&optional backward)
|
2019-02-10 15:10:51 +00:00
|
|
|
"Cycle through themes defined in `dotspacemacs-themes'.
|
2017-10-21 12:33:12 +00:00
|
|
|
When BACKWARD is non-nil, or with universal-argument, cycle backwards."
|
2017-09-29 18:21:50 +00:00
|
|
|
(interactive "P")
|
2020-04-15 08:19:10 +00:00
|
|
|
(let* ((theme-names (mapcar 'spacemacs//get-theme-name dotspacemacs-themes))
|
|
|
|
(themes (if backward (reverse theme-names) theme-names))
|
2017-10-21 12:33:12 +00:00
|
|
|
(next-theme (car (or (cdr (memq spacemacs--cur-theme themes))
|
|
|
|
;; if current theme isn't in cycleable themes, start
|
|
|
|
;; over
|
|
|
|
themes))))
|
2017-09-29 18:21:50 +00:00
|
|
|
(when spacemacs--cur-theme
|
2017-10-21 12:33:12 +00:00
|
|
|
(disable-theme spacemacs--cur-theme))
|
2017-09-29 18:21:50 +00:00
|
|
|
(let ((progress-reporter
|
|
|
|
(make-progress-reporter
|
2017-10-21 12:33:12 +00:00
|
|
|
(format "Loading theme %s..." next-theme))))
|
|
|
|
(spacemacs/load-theme next-theme nil 'disable)
|
2017-09-29 18:21:50 +00:00
|
|
|
(progress-reporter-done progress-reporter))))
|
2015-01-24 03:02:08 +00:00
|
|
|
|
2019-02-10 15:10:51 +00:00
|
|
|
(defun spacemacs/cycle-spacemacs-theme-backward ()
|
|
|
|
"Cycle through themes defined in `dotspacemacs-themes' backward."
|
|
|
|
(interactive)
|
|
|
|
(spacemacs/cycle-spacemacs-theme t))
|
|
|
|
|
2015-01-24 03:02:08 +00:00
|
|
|
(defadvice load-theme (after spacemacs/load-theme-adv activate)
|
|
|
|
"Perform post load processing."
|
|
|
|
(let ((theme (ad-get-arg 0)))
|
2015-12-01 06:21:03 +00:00
|
|
|
;; Without this a popup is raised every time emacs25 starts up for
|
|
|
|
;; assignment to a free variable
|
2015-11-30 22:03:15 +00:00
|
|
|
(with-no-warnings
|
|
|
|
(setq spacemacs--cur-theme theme))
|
2015-01-24 03:02:08 +00:00
|
|
|
(spacemacs/post-theme-init theme)))
|
|
|
|
|
2020-03-14 20:08:31 +00:00
|
|
|
(defun spacemacs/theme-loader ()
|
|
|
|
"Call appropriate theme loader based on completion framework."
|
|
|
|
(interactive)
|
|
|
|
(cond
|
|
|
|
((configuration-layer/layer-used-p 'helm)
|
|
|
|
(call-interactively 'spacemacs/helm-themes))
|
|
|
|
((configuration-layer/layer-used-p 'ivy)
|
|
|
|
(call-interactively 'counsel-load-theme))
|
|
|
|
(t (call-interactively 'load-theme))))
|
|
|
|
|
2015-01-24 03:02:08 +00:00
|
|
|
(defun spacemacs/post-theme-init (theme)
|
2016-07-15 07:14:58 +00:00
|
|
|
"Some processing that needs to be done when the current theme
|
|
|
|
has been changed to THEME."
|
2015-01-24 03:02:08 +00:00
|
|
|
(interactive)
|
2016-07-15 07:14:58 +00:00
|
|
|
(run-hooks 'spacemacs-post-theme-change-hook))
|
2015-01-14 03:14:48 +00:00
|
|
|
|
2017-02-02 03:59:03 +00:00
|
|
|
(defun spacemacs//add-theme-packages-to-additional-packages ()
|
|
|
|
"Add all theme packages from `dotspacemacs-themes' to packages to install."
|
|
|
|
(setq dotspacemacs--additional-theme-packages nil)
|
|
|
|
(dolist (theme dotspacemacs-themes)
|
|
|
|
(let* ((theme-name (spacemacs//get-theme-name theme))
|
|
|
|
(pkg-name (spacemacs/get-theme-package-name theme-name))
|
|
|
|
(theme2 (copy-tree theme)))
|
|
|
|
(when pkg-name
|
|
|
|
(if (listp theme2)
|
|
|
|
(setcar theme2 pkg-name)
|
|
|
|
(setq theme2 pkg-name))
|
|
|
|
(add-to-list 'dotspacemacs--additional-theme-packages theme2)))))
|
2017-07-01 14:54:37 +00:00
|
|
|
(add-hook 'configuration-layer-pre-load-hook
|
2017-02-02 03:59:03 +00:00
|
|
|
'spacemacs//add-theme-packages-to-additional-packages)
|
2017-01-26 04:30:25 +00:00
|
|
|
|
2015-01-27 03:51:47 +00:00
|
|
|
(provide 'core-themes-support)
|