all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: irenezerafa via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: Rainbow delimiters using modus-themes colours
Date: Tue, 09 Nov 2021 09:40:07 +0000	[thread overview]
Message-ID: <7pet0uqtzw00R_MM_c3ui1p3YfPHNyayIHPlqIva6nQ7O9VkvveLpyuoi9ANAll7MuZxEMsh8ZgEfArYt-kLjyXWyONikD49Q8iJYmiuPu0=@protonmail.com> (raw)

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	other threads:[~2021-11-09  9:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='7pet0uqtzw00R_MM_c3ui1p3YfPHNyayIHPlqIva6nQ7O9VkvveLpyuoi9ANAll7MuZxEMsh8ZgEfArYt-kLjyXWyONikD49Q8iJYmiuPu0=@protonmail.com' \
    --to=help-gnu-emacs@gnu.org \
    --cc=irenezerafa@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.