all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Rainbow delimiters using modus-themes colours
@ 2021-11-09  9:40 irenezerafa via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; only message in thread
From: irenezerafa via Users list for the GNU Emacs text editor @ 2021-11-09  9:40 UTC (permalink / raw)
  To: Help Gnu Emacs

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)) ))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-09  9:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-09  9:40 Rainbow delimiters using modus-themes colours irenezerafa via Users list for the GNU Emacs text editor

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.