help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Rainbow delimiters using modus-themes colours


From: irenezerafa
Subject: Rainbow delimiters using modus-themes colours
Date: Tue, 09 Nov 2021 09:40:07 +0000

I have modified rainbow-delimiters to use colours from modus themes as shown 
below.
But I also want to have the original colour scheme when one is not using 
modus-themes.

I am stuck on what to do now.

Here is the implementation to use modus-themes intense colours.

(require 'modus-themes)

(defmacro rainbow-delimiters-modus-operandi-intense-colours (&rest body)
"Evaluate BODY with colors from modus-operandi."
(declare (indent 0))
(let ((palette-sym (gensym))
(colors (mapcar #'car modus-themes-operandi-colors)))
`(let* ((class '((class color) (min-colors 89)))
(,palette-sym (modus-themes--palette 'modus-operandi))
,@(mapcar (lambda (color)
(list color `(alist-get ',color ,palette-sym)))
colors))
(ignore class ,@colors) ; Silence unused variable warnings
,@body)))

(defmacro rainbow-delimiters-modus-vivendi-intense-colours (&rest body)
"Evaluate BODY with colors from modus-vivendi."
(declare (indent 0))
(let ((palette-sym (gensym))
(colors (mapcar #'car modus-themes-vivendi-colors)))
`(let* ((class '((class color) (min-colors 89)))
(,palette-sym (modus-themes--palette 'modus-vivendi))
,@(mapcar (lambda (color)
(list color `(alist-get ',color ,palette-sym)))
colors))
(ignore class ,@colors)
,@body)))

(eval-when-compile
(defmacro rainbow-delimiters--define-depth-faces ()
(let ( (faces '())
(light-colors (rainbow-delimiters-modus-operandi-intense-colours
(list magenta-intense cyan-intense orange-intense
purple-intense green-intense red-intense
blue-intense yellow-intense fg-main)))
(dark-colors (rainbow-delimiters-modus-vivendi-intense-colours
(list magenta-intense cyan-intense orange-intense
purple-intense green-intense red-intense
blue-intense yellow-intense fg-main))) )
(dotimes (i 9)
(push `(defface ,(intern (format "rainbow-delimiters-depth-%d-face" (1+ i)))
'( (default (:inherit rainbow-delimiters-base-face))
( ((class color) (background light))
:foreground ,(nth i light-colors))
( ((class color) (background dark))
:foreground ,(nth i dark-colors)) )
,(format "Nested delimiter face, depth %d." (1+ i))
:group 'rainbow-delimiters-faces)
faces))
`(progn ,@faces)) ))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]