color layer: colorize keywords and function name face
Can be customized with `rainbow-identifiers-faces-to-override`
This commit is contained in:
parent
2bec380d68
commit
14f33332a8
|
@ -36,40 +36,18 @@ which require an initialization must be listed explicitly in the list.")
|
||||||
rainbow-identifiers-cie-l*a*b*-lightness 40
|
rainbow-identifiers-cie-l*a*b*-lightness 40
|
||||||
;; override theme faces
|
;; override theme faces
|
||||||
rainbow-identifiers-faces-to-override '(highlight-quoted-symbol
|
rainbow-identifiers-faces-to-override '(highlight-quoted-symbol
|
||||||
|
font-lock-keyword-face
|
||||||
|
font-lock-function-name-face
|
||||||
font-lock-variable-name-face))
|
font-lock-variable-name-face))
|
||||||
|
|
||||||
(defun colors/toggle-rainbow-indentifiers ()
|
(spacemacs|add-toggle rainbow-identifier-globally
|
||||||
"Toggle rainbow identifiers."
|
:status rainbow-identifiers-mode
|
||||||
(interactive)
|
:on (rainbow-identifiers-mode)
|
||||||
(if (and (boundp 'rainbow-identifiers-mode)
|
:off (rainbow-identifiers-mode -1)
|
||||||
(symbol-value rainbow-identifiers-mode))
|
:documentation "Colorize identifiers globally."
|
||||||
(progn
|
:evil-leader "tCi")
|
||||||
(colors//tweak-theme-colors-font-lock t)
|
|
||||||
(rainbow-identifiers-mode -1))
|
|
||||||
(colors//tweak-theme-colors-font-lock)
|
|
||||||
(rainbow-identifiers-mode)))
|
|
||||||
(evil-leader/set-key "tCi" 'colors/toggle-rainbow-indentifiers)
|
|
||||||
|
|
||||||
(add-to-hooks 'rainbow-identifiers-mode '(prog-mode-hook
|
(add-hook 'prog-mode-hook 'rainbow-identifiers-mode)
|
||||||
erlang-mode-hook))
|
|
||||||
|
|
||||||
(defun colors//tweak-theme-colors-font-lock (&optional restore)
|
|
||||||
"Nilify some font locks. If RESTORE in non nil the font locks are
|
|
||||||
restored."
|
|
||||||
(unless (eq 'spacemacs-mode major-mode)
|
|
||||||
;; To make the variables stand out, keyword coloring is disabled
|
|
||||||
(cond
|
|
||||||
(restore
|
|
||||||
(set-attributes-from-alist
|
|
||||||
'font-lock-function-name-face original-font-lock-function-name-face-attributes)
|
|
||||||
(set-attributes-from-alist
|
|
||||||
'font-lock-keyword-face original-font-lock-keyword-face-attributes))
|
|
||||||
(t
|
|
||||||
(set-face-attribute 'font-lock-function-name-face nil
|
|
||||||
:foreground nil :slant 'normal :weight 'normal)
|
|
||||||
(set-face-attribute 'font-lock-keyword-face nil
|
|
||||||
:foreground nil :slant 'normal :weight 'bold)))
|
|
||||||
(font-lock-fontify-buffer)))
|
|
||||||
|
|
||||||
(defun colors//tweak-theme-colors (theme)
|
(defun colors//tweak-theme-colors (theme)
|
||||||
"Tweak color themes by adjusting rainbow-identifiers colors settings an by
|
"Tweak color themes by adjusting rainbow-identifiers colors settings an by
|
||||||
|
@ -98,9 +76,7 @@ disabling some faces in order to make colored identifiers stand out."
|
||||||
(setq original-font-lock-function-name-face-attributes
|
(setq original-font-lock-function-name-face-attributes
|
||||||
(face-all-attributes font-lock-function-name-face frame))
|
(face-all-attributes font-lock-function-name-face frame))
|
||||||
(setq original-font-lock-keyword-face-attributes
|
(setq original-font-lock-keyword-face-attributes
|
||||||
(face-all-attributes font-lock-keyword-face frame)))
|
(face-all-attributes font-lock-keyword-face frame)))))
|
||||||
;; tweak the font locks
|
|
||||||
(colors//tweak-theme-colors-font-lock)))
|
|
||||||
(colors//tweak-theme-colors spacemacs--cur-theme)
|
(colors//tweak-theme-colors spacemacs--cur-theme)
|
||||||
|
|
||||||
(defadvice spacemacs/post-theme-init (after colors/post-theme-init activate)
|
(defadvice spacemacs/post-theme-init (after colors/post-theme-init activate)
|
||||||
|
@ -133,7 +109,7 @@ Press any other key to exit." component (eval var) component component)))
|
||||||
(define-key map (kbd "-") down-func)
|
(define-key map (kbd "-") down-func)
|
||||||
(define-key map (kbd "=") reset-func)
|
(define-key map (kbd "=") reset-func)
|
||||||
map) t)
|
map) t)
|
||||||
(colors//change-color-mini-mode-doc component))
|
(colors//change-color-mini-mode-doc component))
|
||||||
|
|
||||||
(defun colors/start-change-color-saturation ()
|
(defun colors/start-change-color-saturation ()
|
||||||
"Initiate the overlay map to change the saturation."
|
"Initiate the overlay map to change the saturation."
|
||||||
|
|
Loading…
Reference in a new issue