10. Themes and faces

Change theme

clojure
(set-theme! :doom-dark)
代码

- Built-ins are 14 themes: `:space-dark`, `:space-light`, `:doom-dark`, `:doom-light`,
  `:everforest-dark` (default), `:everforest-light`, `:token-dark`, `:token-light`,
  `:token-flint-dark`, `:token-flint-light`, `:token-temper-dark`,
  `:token-temper-light`, `:paper-light`, and `:paper-dark`, plus `:terminal`, which
  follows the terminal background without repainting normal text.
- `M-x load-theme` offers interactive selection (names use their own foreground color
  and include color swatches); `M-m T n` rotates themes.
- Interactive selection is stored in `<config>/theme.edn` and is used first on the next
  startup; `set-theme!` in `init.clj` overrides it.

### Override faces
clojure
(set-face! :region {:bg "#3a3a5a"})
(set-face! :font-lock-comment-face {:fg "#7f8c98" :italic true})
代码

Colors accept `"#rrggbb"` or `[r g b]`. Available properties are `:fg`, `:bg`, `:bold`,
`:italic`, `:underline`, and `:underline-color`. Overrides are stored in
`:face-overrides` and **survive theme changes**.

### Register your own theme
clojure
;; Palette style: copy a built-in palette and change selected slots.
(register-theme!
  {:name :my-dark :label "My dark"
   :palette (palette-with (palette :space-dark) :keyword "#ff79c6")})

;; Difference style: only list faces to change. `:base` is the fallback theme
;; (the built-in default theme); `:none` means no fallback.
(register-theme!
  {:name :my-paper :label "My paper" :base :paper-light
   :faces {:region {:bg "#e8e0d0"} :cursor {:bg "#333333"}}})

(set-theme! :my-dark)
代码

Palette slot names follow spacemacs-theme (`:bg1`, `:base`, `:keyword`, `:func`,
`:comment`, …; see `:slots` in `resources/coxn/themes.edn`). Each slot accepts one
`"#rrggbb"` or a two-value vector `["#true-color" "#256-color-fallback"]`.

Raw Markdown: coxn manual (Markdown) · Installers: coxn product page