[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 11:28:20 +0000 |
On Tuesday, February 1st, 2022 at 10:34 AM, Manuel Giraud
<manuel@ledu-giraud.fr> wrote:
> 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---
I wonder if there is any way that colours change whether one is using a light
or dark theme. Is the light and dark setting inherent to emacs, or inherent to
the theme? For instance the default can still check if the theme uses a light
or dark background. Better still, the annotation colours could be set up for
light and dark background irrespective of the particular instance of
modus-themes. Meaning that the colours are set for any theme one could be
using.
> --
>
> Manuel Giraud