colors layer: new variable colors-theme-identifiers-sat&light

add support for jazz theme
This commit is contained in:
syl20bnr 2015-05-10 10:36:07 -04:00
parent fc8dc9c285
commit b46a200fa6
3 changed files with 31 additions and 27 deletions

View file

@ -50,6 +50,17 @@ To enable the package `rainbow-identifiers` set the variable
(colors :variables colors-enable-rainbow-identifiers t)))
```
Saturation and lightness of identifiers can be set per theme by adding
an entry in the variable `colors-theme-identifiers-sat&light`. This
is an alist where the key is a theme symbol and the value is a pair
`(saturation lightness)`.
Example:
```elisp
(push '(mytheme . (50 50)) colors-theme-identifiers-sat&light)
```
### Enable Nyan cat
To enable the package `nyan-mode` set the variable

View file

@ -13,10 +13,21 @@
;; Variables
(defvar colors-enable-rainbow-identifiers nil
"if non nil the `rainbow-identifers' package is enabled.")
"If non nil the `rainbow-identifers' package is enabled.")
(defvar colors-enable-nyan-cat-progress-bar nil
"if non nil all nyan cat packges are enabled (for now only `nyan-mode').")
"If non nil all nyan cat packges are enabled (for now only `nyan-mode').")
(defvar colors-theme-identifiers-sat&light
'((jazz . (50 55))
(gotham . (45 60))
(leuven . (100 40))
(material . (95 105))
(monokai . (55 60))
(solarized-dark . (65 55))
(solarized-light . (60 55))
(zenburn . (40 65)))
"alist of theme symbols and pair of saturation and lightness values.")
;; Command prefixes

View file

@ -48,33 +48,15 @@
(add-hook 'prog-mode-hook 'rainbow-identifiers-mode)
(defun colors//tweak-theme-colors (theme)
"Tweak color themes by adjusting rainbow-identifiers colors settings an by
disabling some faces in order to make colored identifiers stand out."
"Tweak color themes by adjusting rainbow-identifiers."
(interactive)
;; tweak the saturation and lightness of identifier colors
(pcase theme
(`gotham (setq rainbow-identifiers-cie-l*a*b*-saturation 45
rainbow-identifiers-cie-l*a*b*-lightness 60))
(`leuven (setq rainbow-identifiers-cie-l*a*b*-saturation 100
rainbow-identifiers-cie-l*a*b*-lightness 40))
(`material (setq rainbow-identifiers-cie-l*a*b*-saturation 95
rainbow-identifiers-cie-l*a*b*-lightness 105))
(`monokai (setq rainbow-identifiers-cie-l*a*b*-saturation 55
rainbow-identifiers-cie-l*a*b*-lightness 60))
(`solarized-dark (setq rainbow-identifiers-cie-l*a*b*-saturation 65
rainbow-identifiers-cie-l*a*b*-lightness 55))
(`solarized-light (setq rainbow-identifiers-cie-l*a*b*-saturation 60
rainbow-identifiers-cie-l*a*b*-lightness 55))
(`zenburn (setq rainbow-identifiers-cie-l*a*b*-saturation 40
rainbow-identifiers-cie-l*a*b*-lightness 65))
(_ (setq rainbow-identifiers-cie-l*a*b*-saturation 80
rainbow-identifiers-cie-l*a*b*-lightness 45)))
;; backup to original font locks
(let ((frame (selected-frame)))
(setq original-font-lock-function-name-face-attributes
(face-all-attributes font-lock-function-name-face frame))
(setq original-font-lock-keyword-face-attributes
(face-all-attributes font-lock-keyword-face frame)))))
(let ((sat&light (assq theme colors-theme-identifiers-sat&light)))
(if sat&light
(setq rainbow-identifiers-cie-l*a*b*-saturation (cadr sat&light)
rainbow-identifiers-cie-l*a*b*-lightness (caddr sat&light))
(setq rainbow-identifiers-cie-l*a*b*-saturation 80
rainbow-identifiers-cie-l*a*b*-lightness 45)))))
(colors//tweak-theme-colors spacemacs--cur-theme)
(defadvice spacemacs/post-theme-init (after colors/post-theme-init activate)