From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Giraud Newsgroups: gmane.emacs.help Subject: Re: Setting colour for comments for light and dark theme Date: Tue, 01 Feb 2022 11:34:28 +0100 Message-ID: <87sft27u4r.fsf@elite.giraud> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36996"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (berkeley-unix) Cc: goncholden To: goncholden via Users list for the GNU Emacs text editor Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 01 11:35:49 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 1nEqVp-0009Px-4o for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 01 Feb 2022 11:35:49 +0100 Original-Received: from localhost ([::1]:49230 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nEqVo-0002GH-1x for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 01 Feb 2022 05:35:48 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47986) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEqUc-0001jl-7m for help-gnu-emacs@gnu.org; Tue, 01 Feb 2022 05:34:34 -0500 Original-Received: from ledu-giraud.fr ([51.159.28.247]:15914) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nEqUa-00061p-4o for help-gnu-emacs@gnu.org; Tue, 01 Feb 2022 05:34:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=rsa; bh=yy7xkvzPqldRwA8D /mWNMgzNzvtGQkP19sglV4aY2H0=; h=in-reply-to:date:references:subject: cc:to:from; d=ledu-giraud.fr; b=ux5BKcuibspLDNWF7vwJRbjn23ai1tQt1wmpGy bv2OTxzO34PxLExMDO4Ozcsgyv34+1Bu/Y1enDzDuzucwFPVy6uqF/3kaEwFKha2U0stGT PK8EIrX4P/FGaMDuQ1QwOpWCsFD2EfYs13HykiscEa88Ldyt/vvwy6YaGhnLg41ft3CR3D 98Qu/HUSXqnD14G0C0GHPp/ErB2JtpF+Gd9C3ShBMPfYUsdVxvGGapRP39vmmmkAW23P+7 lB3Kb5Iuaq/+n258TCMPLk2hMYNGU9ASiGxfPd/8wncMzuz46bZPQ/ahbRpGkE8l6Dmi4S N06w1iKFYgb+LXbqeptl6s8w== Original-Received: from elite.giraud ( [10.1.1.1]) by ledu-giraud.fr (OpenSMTPD) with ESMTPSA id f85fbf2b (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Tue, 1 Feb 2022 11:34:29 +0100 (CET) In-Reply-To: (goncholden via Users list for the's message of "Tue, 01 Feb 2022 09:38:40 +0000") Received-SPF: pass client-ip=51.159.28.247; envelope-from=manuel@ledu-giraud.fr; helo=ledu-giraud.fr 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, SPF_HELO_PASS=-0.001, SPF_PASS=-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:135620 Archived-At: 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--- -- Manuel Giraud