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

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

Using frame--current-backround-mode with emacs version check


From: goncholden
Subject: Using frame--current-backround-mode with emacs version check
Date: Tue, 01 Feb 2022 13:18:10 +0000

I am trying to use (frame--current-backround-mode nil) to use either a light or 
dark comment colours.
frame--current-backround-mode was introduced in commit 
9a6523dfd68a17ebf7049d2aae3fd02386d7cb04
from 2021-04-12. So it must be for Emacs 28 or higher.

I am trying to check the emacs version, but I am getting stuck.

(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."

(let* ( (colors annotation-chroma)
(levels

(>= emacs-major-version 28)

(alist-get (frame--current-backround-mode nil) colors) ) )

;; make comment colour change buffer-local
(face-remap-add-relative 'font-lock-comment-face
`(:foreground ,(alist-get chroma levels))) ) )

(frame--current-backround-mode nil)

reply via email to

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