all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: goncholden via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: goncholden via Users list for the GNU Emacs text editor
	<help-gnu-emacs@gnu.org>
Subject: Using frame--current-backround-mode with emacs version check
Date: Tue, 01 Feb 2022 13:18:10 +0000	[thread overview]
Message-ID: <MqvAZxDV0K8rh_d_-X-y-m88X6VEObn7Rh5hiQioDByN69RiKpTfBt1opKkjm5fMiQwCbfRvUKey9o4irty3odsVXbW4wVQ0yn78V40Su90=@protonmail.com> (raw)

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	other threads:[~2022-02-01 13:18 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='MqvAZxDV0K8rh_d_-X-y-m88X6VEObn7Rh5hiQioDByN69RiKpTfBt1opKkjm5fMiQwCbfRvUKey9o4irty3odsVXbW4wVQ0yn78V40Su90=@protonmail.com' \
    --to=help-gnu-emacs@gnu.org \
    --cc=goncholden@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.