From b46a200fa627049432d56a88cbb4db080bdfbba8 Mon Sep 17 00:00:00 2001 From: syl20bnr Date: Sun, 10 May 2015 10:36:07 -0400 Subject: [PATCH] colors layer: new variable `colors-theme-identifiers-sat&light` add support for jazz theme --- contrib/colors/README.md | 11 +++++++++++ contrib/colors/config.el | 15 +++++++++++++-- contrib/colors/packages.el | 32 +++++++------------------------- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/contrib/colors/README.md b/contrib/colors/README.md index 6b9718c36..e9ebea864 100644 --- a/contrib/colors/README.md +++ b/contrib/colors/README.md @@ -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 diff --git a/contrib/colors/config.el b/contrib/colors/config.el index e09fa7687..648a348ad 100644 --- a/contrib/colors/config.el +++ b/contrib/colors/config.el @@ -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 diff --git a/contrib/colors/packages.el b/contrib/colors/packages.el index 0a63fbd26..e78d29ea9 100644 --- a/contrib/colors/packages.el +++ b/contrib/colors/packages.el @@ -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)