From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: goncholden Newsgroups: gmane.emacs.help Subject: Setting colour for comments for light and dark theme Date: Tue, 01 Feb 2022 12:35:13 +0000 Message-ID: References: <87sft27u4r.fsf@elite.giraud> Reply-To: goncholden Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16075"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Manuel Giraud , goncholden via Users list for the GNU Emacs text editor To: goncholden Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 01 15:58:43 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nEucE-0003xl-Kv for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 01 Feb 2022 15:58:42 +0100 Original-Received: from localhost ([::1]:42620 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nEucD-0006xa-2F for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 01 Feb 2022 09:58:41 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:49468) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEsOH-0006I6-Gw for help-gnu-emacs@gnu.org; Tue, 01 Feb 2022 07:36:09 -0500 Original-Received: from mail-40140.protonmail.ch ([185.70.40.140]:29244) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEsO9-0000mH-FC for help-gnu-emacs@gnu.org; Tue, 01 Feb 2022 07:36:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail2; t=1643718914; bh=6afHQEMGKbe3v5MjINF4qiMD/QcG1lplgJY15ArJ4l8=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To: References:From:To:Cc; b=VujGDhap/588PM+j+Gr2tLoynRp9Ffam7r+Ij1fI7HgGbBEQpk+CDq0pv4g3uqzMS p0JLbS4VJm3fPv125l6XoKMHGkBYyi57akMpY4vpYxxhs0b2OmtreguMl1b38SL6yL RR+uRC+5Yq7Ms8FzcA+CofzqtDMwEbF5lzigCFkZ7gGaBHhC1SPkajntHLwjWs8O4U +QGZwvMptPjbTYqxam5fytBZayI+hq64vU2HzD8/KEjBmHGHzd62KoEPd7Jk54xPTo 7GD/NpIpcu/PiJvm1Y41uFPIHCnAmf6bbcVpztrAZTUYlIfUy6sfrdfK5lbsEam+ei mDV3bzVNz/ANQ== In-Reply-To: Received-SPF: pass client-ip=185.70.40.140; envelope-from=goncholden@protonmail.com; helo=mail-40140.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, TO_EQ_FM_DIRECT_MX=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:135623 Archived-At: Sent with ProtonMail Secure Email. =E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90 Original Me= ssage =E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90=E2=80=90 On Tuesday, February 1st, 2022 at 11:28 AM, goncholden wrote: > On Tuesday, February 1st, 2022 at 10:34 AM, Manuel Giraud manuel@ledu-gir= aud.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 l= ight or dark theme. Is the light and dark setting inherent to emacs, or inh= erent to the theme? For instance the default can still check if the theme u= ses a light or dark background. Better still, the annotation colours could = be set up for light and dark background irrespective of the particular inst= ance of modus-themes. Meaning that the colours are set for any theme one co= uld be using. Have tried using (frame--current-backround-mode nil) but this gives Symbol's function definition is void: frame--current-backround-mode I am using Emacs 27.1 > > -- > > > > Manuel Giraud