【问题标题】:Spacemacs custom colorSpacemacs 自定义颜色
【发布时间】:2017-08-19 18:29:51
【问题描述】:

我最近切换到 Spacemacs,并且正在尝试合并我自己的自定义颜色主题。通常,我会做这样的事情。

(setq-default dotspacemacs-themes '(firebelly))  ;; additionally use with spacemacs

(use-package firebelly-theme
  :config (progn
        (let
        ;; This beautiful palette is shamelessly stolen from chris
        ;; kempson's base16: https://github.com/chriskempson/base16
        ;; I keep a local copy of the firebelly colour layout so I
        ;; can tweak it to my taste
        ((palette
          '("#ac4142" "#d28445" "#f4bf75" "#90a959"
            "#75b5aa" "#6a9fb5" "#aa759f" "#8f5536"))
         ;; Simple grayscale palette.
         (greys
          '("#222222" "#292929" "#444444" "#555555"
            "#666666" "#777777" "#888888" "#999999")))
          ;; Tiny functions to make getting from the palettes easier.
          (cl-flet
          ((color (n) (nth n palette))
           (grey (n) (nth n greys)))
        ;; Define some faces for our theme.
        (custom-theme-set-faces
         'firebelly
                 ;;;; Styling emacs.
         `(default
            ((t (:background ,(grey 0) :foreground ,(grey 7)))))
         `(cursor
           ((t (:background ,(grey 3)))))
         `(highlight
           ((t (:background ,(color 5) :foreground ,(grey 3)))))
         `(shadow
           ((t (:foreground ,(grey 6)))))
         `(isearch
           ((t (:background ,(grey 2) :foreground ,(color 6)))))
         `(query-replace
           ((t (:background ,(grey 2) :foreground ,(color 6)))))
         `(lazy-highlight
           ((t (:background ,(grey 1) :foreground ,(grey 3)))))
         `(minibuffer-prompt
           ((t (:foreground ,(color 1)))))
         `(trailing-whitespace
           ((t (:background ,(grey 1)))))
         `(nobreak-space
           ((t (:background ,(grey 1)))))
         `(escape-glyph
           ((t (:foreground ,(color 2)))))
         ;; Fringes are ugly.
         `(fringe
           ((t (:background ,(grey 0)))))
         ;; Highlight the border.
         `(vertical-border
           ((t (:foreground ,(grey 1)))))
         ;; Mode lines look the same but for the text.
         `(mode-line
           ((t (:background ,(grey 1) :foreground ,(grey 6) :box nil))))
         `(mode-line-inactive
           ((t (:background ,(grey 1) :foreground ,(grey 3) :box nil))))
         `(header-line
           ((t (:background ,(grey 1) :foreground ,(grey 3) :box nil))))
         `(mode-line-buffer-id
           ((t (:bold t))))
         `(mode-line-highlight
           ((t (:foreground ,(grey 7)))))
         ;; Regions are slightly lighter.
         `(region
           ((t (:background ,(grey 2)))))
         `(secondary-selection
           ((t (:background ,(grey 2)))))
    ;;;; Styling code.
         ;; Comments are lighter than their delimiters.
         `(font-lock-comment-face
           ((t (:foreground ,(grey 4)))))
         `(font-lock-comment-delimiter-face
           ((t (:foreground ,(grey 2)))))
         ;; Docstrings are slightly lighter.
         `(font-lock-doc-face
           ((t (:foreground ,(grey 4) :background ,(grey 0)))))
         `(font-lock-function-name-face
           ((t (:foreground ,(color 3)))))
         `(font-lock-variable-name-face
           ((t (:foreground ,(grey 2)))))
         `(font-lock-builtin-face
           ((t (:foreground ,(color 6)))))
         `(font-lock-constant-face
           ((t (:foreground ,(color 1)))))
         `(font-lock-type-face
           ((t (:foreground ,(color 4)))))
         `(font-lock-string-face
           ((t (:foreground ,(color 5) :background ,(grey 1)))))
         `(font-lock-keyword-face
           ((t (:foreground ,(color 6)))))
    ;;;; Styling extensions.
         ;; Erc faces.
         `(erc-notice-face
           ((t (:foreground ,(grey 2)))))
         `(erc-current-nick-face
           ((t (:foreground ,(color 3) :bold t))))
         `(erc-prompt-face
           ((t (:foreground ,(color 1) :background ,(grey 0)))))
         `(erc-input-face
           ((t (:foreground ,(grey 6)))))
         `(erc-my-nick-face
           ((t (:foreground ,(color 1)))))
         `(erc-error-face
           ((t (:foreground ,(color 0)))))
         `(erc-timestamp-face
           ((t (:foreground ,(color 3)))))
         ;; Rainbow delimiters are mostly in order.
         `(rainbow-delimiters-depth-1-face
           ((t (:foreground ,(color 7)))))
         `(rainbow-delimiters-depth-2-face
           ((t (:foreground ,(color 6)))))
         `(rainbow-delimiters-depth-3-face
           ((t (:foreground ,(color 5)))))
         `(rainbow-delimiters-depth-4-face
           ((t (:foreground ,(grey 3)))))
         `(rainbow-delimiters-depth-5-face
           ((t (:foreground ,(color 4)))))
         `(rainbow-delimiters-depth-6-face
           ((t (:foreground ,(color 3)))))
         `(rainbow-delimiters-depth-7-face
           ((t (:foreground ,(color 2)))))
         `(rainbow-delimiters-depth-8-face
           ((t (:foreground ,(color 1)))))
         `(rainbow-delimiters-depth-9-face
           ((t (:foreground ,(color 0)))))
         ;; shm faces
         `(shm-current-face
           ((t (:background ,(grey 1)))))
         `(shm-quarantine-face
           ((t (:foreground ,(color 0) :background ,(grey 1)))))
         ;; linum-relative faces
         `(linum-relative-current-face
           ((t (:background ,(grey 0) :foreground ,(color 1))))))))))

Spacemacs 具有custom themes and colors 的机制。但这不起作用,当直接在我的自定义层中调用时(请参阅herehere)。

【问题讨论】:

    标签: emacs colors color-scheme spacemacs


    【解决方案1】:

    好的,这个也解决了。我刚拿了firebelly repo,把它做成了spacemacs层。为此,我所做的只是:

    1. 将 repo 作为子目录克隆到我的 .spacemacs.d/layers 目录。
    2. packages.el -> firebelly-theme.el (A) 建立了一个软链接。
    3. 在配置层列表中添加了新的 firebelly 层 dotspacemacs-configuration-layers(在 .spacemacs.d/init.el 中)(B)。

    一)

    firebelly/
    ├── firebelly-theme.el
    ├── packages.el -> firebelly-theme.el
    ├── readme.md
    └── screenshot.png
    

    B)

    dotspacemacs-configuration-layers
       '(
         ...
         firebelly)
    

    希望这对其他人有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-07-20
      • 2019-03-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-04-03
      • 2010-11-14
      相关资源
      最近更新 更多