2015-10-30 11:20:58 +00:00
#+TITLE : Theming layer
2015-10-20 18:15:15 +00:00
2019-05-02 21:49:30 +00:00
#+TAGS : layer|theme
2019-05-07 20:05:06 +00:00
* Table of Contents :TOC_5_gh:noexport:
2017-05-22 14:16:12 +00:00
- [[#description ][Description ]]
2017-11-19 16:39:53 +00:00
- [[#features ][Features: ]]
2017-05-22 14:16:12 +00:00
- [[#install ][Install ]]
- [[#usage ][Usage ]]
- [[#example ][Example ]]
- [[#attributes ][Attributes ]]
- [[#faces ][Faces ]]
- [[#headers ][Headers ]]
2016-10-31 17:49:18 +00:00
- [[#example-1 ][Example ]]
2015-10-20 18:15:15 +00:00
2015-10-30 11:20:58 +00:00
* Description
2015-10-20 18:15:15 +00:00
This layer allows for a simple way of modifying themes.
2017-11-19 16:39:53 +00:00
** Features:
2018-09-19 03:54:47 +00:00
- Modify themes from your =.spacemacs= .
- Tweak face attributes and other aspects of themes.
- Includes three additional layer variables for tweaking headings.
2017-11-19 16:39:53 +00:00
2015-10-30 11:20:58 +00:00
* Install
2016-01-06 05:21:55 +00:00
To use this configuration layer, add it to your =~/.spacemacs= . You will need to
add =theming= to the existing =dotspacemacs-configuration-layers= list in this
file.
2015-10-20 18:15:15 +00:00
2015-10-30 11:20:58 +00:00
* Usage
2016-10-31 17:49:18 +00:00
To use this layer, set the value of =theming-modifications= (a good place is
inside your =.spacemacs= in =dotspacemacs/user-init()= ).
It should be a list of the following form:
2015-10-20 18:15:15 +00:00
2018-09-19 03:54:47 +00:00
#+BEGIN_SRC emacs-lisp
2015-10-20 18:15:15 +00:00
((theme1 (face1 attributes...)
(face2 attributes...)
...)
(theme2 (face1 attributes...)
(face2 attributes...)
...)
...)
2018-09-19 03:54:47 +00:00
#+END_SRC
2017-03-19 10:48:10 +00:00
2017-04-18 04:23:16 +00:00
** Example
2018-09-19 03:54:47 +00:00
#+BEGIN_SRC lisp
2017-03-19 10:48:10 +00:00
(defun dotspacemacs/user-init ()
2017-04-18 04:23:16 +00:00
(setq theming-modifications
'((monokai
;; Font locking
(font-lock-comment-face :slant italic)
(web-mode-html-attr-name-face :inherit font-lock-variable-name-face
:foreground nil)
;; Modeline
(powerline-active1 :box (:color "#999999"
:line-width 1
:style released-button)
:background "#5a5a5a")))))
2018-09-19 03:54:47 +00:00
#+END_SRC
2018-07-10 10:57:25 +00:00
2017-04-18 04:23:16 +00:00
Source: [[https://gist.github.com/TheBB/f25a607b9bda4d5861f2#file-init-el-L274 ][gist ]]
2015-10-20 18:15:15 +00:00
This will apply the given attributes to the relevant faces whenever the
2016-02-07 13:39:54 +00:00
appropriate theme is loaded. To update without changing the theme, use ~SPC SPC
2015-10-20 18:15:15 +00:00
spacemacs/update-theme~.
2015-10-30 11:20:58 +00:00
* Attributes
2015-10-20 18:15:15 +00:00
See [[http://www.gnu.org/software/emacs/manual/html_node/elisp/Face-Attributes.html#Face-Attributes ][face attributes ]] in the Emacs manual for more information. Some of the more
common attributes you might want to tweak are the following:
2020-07-18 07:52:04 +00:00
- =:inherit= :: the name of a face to inherit attributes from
- =:foreground= and =:background= :: Hexadecimal color strings
- =:height= :: typically a floating point number (1.0 gives the same height as the underlying face)
- =:weight= :: typically =bold= or =normal=
- =:underline= :: typically =nil= or =t=
- =:slant= :: typically =oblique= , =italic= or =normal=
- =:box= :: set to =t= to draw a box around characters in the foreground
2015-10-20 18:15:15 +00:00
2015-10-30 11:20:58 +00:00
* Faces
2016-02-07 13:39:54 +00:00
To see a list over all loaded faces and what they look like, use ~SPC SPC
2015-10-20 18:15:15 +00:00
list-faces-display~. You can also use ~SPC h d c~ (describe character) on a
character to see its face.
Some of the most common faces to modify are the syntactical elements:
- =font-lock-builtin-face=
- =font-lock-comment-delimiter-face=
- =font-lock-comment-face=
- =font-lock-constant-face=
- =font-lock-doc-face=
- =font-lock-function-name-face=
- =font-lock-keyword-face=
- =font-lock-preprocessor-face=
- =font-lock-string-face=
- =font-lock-type-face=
- =font-lock-variable-name-face=
- =font-lock-warning-face=
As well as the mode-line faces for the active and inactive windows:
- =powerline-active1=
- =powerline-active2=
- =powerline-inactive1=
- =powerline-inactive2=
- =mode-line=
- =mode-line-inactive=
2015-10-30 11:20:58 +00:00
* Headers
2015-10-20 18:15:15 +00:00
This layer includes three additional layer variables for tweaking headings.
Allowed values are a list of themes in which the given effect should happen, or
the symbol =all= to apply it on all themes.
2020-07-18 07:52:04 +00:00
- =theming-headings-inherit-from-default= :: inherits all headings from the default face to avoid non-monospaced fonts
- =theming-headings-same-size= :: sets the =:height= attribute to one on all headings to give them the same size as the rest of the text
- =theming-headings-bold= :: sets the =:weight= attribute to bold on all headings
2016-10-31 17:49:18 +00:00
* Example
An example of how to set the default font colour to be black in a custom theme leuven:
2018-09-19 03:54:47 +00:00
#+BEGIN_SRC emacs-lisp
(defun dotspacemacs/user-init ()
2016-10-31 17:49:18 +00:00
2018-09-19 03:54:47 +00:00
; custom theme modification - overriding default font colour
(setq-default
theming-modifications
'((leuven
(default :foreground "#000000")
))
)
2016-10-31 17:49:18 +00:00
2018-09-19 03:54:47 +00:00
)
#+END_SRC