Add support for custom default theme

This commit is contained in:
syl20bnr 2014-11-27 23:14:51 -05:00
parent 8262c953fe
commit aebe9543d7
8 changed files with 44 additions and 14 deletions

View File

@ -528,7 +528,16 @@ Additional information may as well be displayed in the minibuffer.
# Color theme
By default, `Spacemacs` uses the theme [Solarized][solarized-theme].
By default, `Spacemacs` uses the theme [solarized-light][solarized-theme].
It is possible to define your default theme in your `~/.spacemacs` with
the variable `dotspacemacs-default-theme`. For instance, to specify `zenburn`:
```elisp
(setq-default
;; Default theme applied at startup
dotspacemacs-default-theme 'zenburn)
```
Key Binding | Description
---------------------|------------------------------------------------------------

View File

@ -426,6 +426,7 @@ deleted safely."
(spacemacs/append-to-buffer
(format "[%s packages loaded in %.3fs]\n"
(config-system/initialized-packages-count)
elapsed))))))
elapsed)))
)))
(provide 'config-system)

View File

@ -7,6 +7,9 @@ Paths must have a trailing slash (ie. `~/.mycontribs/')"
"list of contribution to load."
)
(defvar dotspacemacs-default0theme 'solarized-light
"Default theme used to start Spacemacs.")
(defvar dotspacemacs-fullscreen-at-startup nil
"If non nil the frame is maximized when Emacs starts up (Emacs 24.4+ only).")

View File

@ -59,12 +59,22 @@
;; no welcome buffer
(setq inhibit-startup-screen t)
;; load the default theme manually to give a smooth startup experience
(spacemacs/load-or-install-package 'dash)
(add-to-list 'load-path "~/.emacs.d/spacemacs/extensions/solarized-theme/")
(require 'solarized)
(deftheme solarized-dark "The dark variant of the Solarized colour theme")
(deftheme solarized-light "The light variant of the Solarized colour theme")
(create-solarized-theme 'light 'solarized-light)
(if (or (eq 'solarized-light dotspacemacs-default-theme)
(eq 'solarized-dark dotspacemacs-default-theme))
(progn
(add-to-list 'load-path (concat spacemacs-directory
"extensions/solarized-theme/"))
;; solarized dependency
(spacemacs/load-or-install-package 'dash)
(require 'solarized)
(deftheme solarized-dark "The dark variant of the Solarized colour theme")
(deftheme solarized-light "The light variant of the Solarized colour theme"))
;; other themes
;; we assume that the package name is suffixed with `-theme'
;; if not we will handle the special themes as we get issues in the tracker.
(let ((pkg (format "%s-theme" (symbol-name dotspacemacs-default-theme))))
(spacemacs/load-or-install-package (intern pkg))))
(load-theme dotspacemacs-default-theme t)
;; font
;; Dynamic font size depending on the system
(let ((font "Source Code Pro"))

View File

@ -5,6 +5,8 @@
;; Variables
(setq-default
;; Default theme applied at startup
dotspacemacs-default-theme 'solarized-light
;; List of additional paths where to look for configuration layers.
;; Paths must have a trailing slash (ie. `~/.mycontribs/')
dotspacemacs-configuration-layer-path '()

View File

@ -1,6 +1,8 @@
(load (concat user-emacs-directory "core/spacemacs-mode.el"))
(require 'config-system)
(dotspacemacs/load)
;; spacemacs special buffer
(spacemacs/buffer)
@ -9,7 +11,6 @@
(config-system/package.el-initialize)
;; Initializing configuration from ~/.spacemacs
(dotspacemacs/load)
(dotspacemacs|call-func dotspacemacs/init)
;; Load configuration layers

View File

@ -15,6 +15,7 @@
evil-plugins
helm-rcirc
o-blog
solarized-theme
spray
))
@ -92,3 +93,10 @@
(spray-quit)
(set-default-evil-insert-state-cursor)
(evil-normal-state))))))
(defun spacemacs/init-solarized-theme ()
(use-package solarized
:init
(progn
(deftheme solarized-dark "The dark variant of the Solarized colour theme")
(deftheme solarized-light "The light variant of the Solarized colour theme"))))

View File

@ -72,14 +72,10 @@
(message "Loading theme %s..." spacemacs-cur-theme)
(load-theme spacemacs-cur-theme t))
(defadvice load-theme (around spacemacs/load-theme-adv activate)
(defadvice load-theme (after spacemacs/load-theme-adv activate)
"Perform post load processing."
(let ((theme (ad-get-arg 0)))
(setq spacemacs-cur-theme theme)
(if (and spacemacs-solarized-dark-createdp
(eq 'solarized-dark theme))
(create-solarized-theme 'dark 'solarized-dark))
ad-do-it
(spacemacs/post-theme-init theme)))
(defun spacemacs/post-theme-init (theme)