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

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

Setting colour for comments for light and dark theme


From: goncholden
Subject: Setting colour for comments for light and dark theme
Date: Tue, 01 Feb 2022 09:38:40 +0000

Have been using the following code to change the colour of comments according
to whether I have a dark or light background. I am using modus-themes. But these
few days I needed to disable modus-themes when debugging and the code breaks
because there are no instructions for when modus-themes is disabled.

(defvar annotation-chroma
'( (dark . ((low . "#8300E0") (mid . "#AA33FF") (high . "#C370FF")))
(light . ((low . "#C16BFF") (mid . "#AA33FF") (high . "#8000DB"))) )
"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)))) )

(face-remap-add-relative 'font-lock-comment-face
`(:foreground ,(alist-get chroma levels))) ) )

reply via email to

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