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

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

Re: Setting colour for comments for light and dark theme


From: Manuel Giraud
Subject: Re: Setting colour for comments for light and dark theme
Date: Tue, 01 Feb 2022 11:34:28 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (berkeley-unix)

Hi,

Maybe you need a default match. Watch out untested code ahead:
--8<---------------cut here---------------start------------->8---
(defvar annotation-chroma
  '((dark . ((low . "#8300E0") (mid . "#AA33FF") (high . "#C370FF")))
    (light . ((low . "#C16BFF") (mid . "#AA33FF") (high . "#8000DB")))
    (default . ((low . "red") (mid . "green") (high . "blue"))))
  "Colour contrast for comments, indigo on dark and light background.")

(defun annotation-typeface (chroma)
  "Set the foreground colour for comments.
CHROMA Intensity Key used for setting colour of comments."
  (let* ((colors annotation-chroma)
         (levels
          (pcase (car custom-enabled-themes)
            ('modus-operandi (alist-get 'light colors))
            ('modus-vivendi (alist-get 'dark colors))
            (_ (alist-get 'default colors)))))
    (face-remap-add-relative 'font-lock-comment-face
                             `(:foreground ,(alist-get chroma levels)))))
--8<---------------cut here---------------end--------------->8---
-- 
Manuel Giraud



reply via email to

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