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 11:28:20 +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="31263"; mail-complaints-to="usenet@ciao.gmane.io" Cc: goncholden via Users list for the GNU Emacs text editor To: Manuel Giraud Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 01 13:26:14 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 1nEsEf-0007vY-SU for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 01 Feb 2022 13:26:13 +0100 Original-Received: from localhost ([::1]:43448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nEsEe-0007CC-AX for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 01 Feb 2022 07:26:12 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:60854) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nErKw-0007C1-5U for help-gnu-emacs@gnu.org; Tue, 01 Feb 2022 06:28:40 -0500 Original-Received: from mail-4318.protonmail.ch ([185.70.43.18]:35179) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nErKs-0005wy-Bt for help-gnu-emacs@gnu.org; Tue, 01 Feb 2022 06:28:37 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail2; t=1643714900; bh=Ts3NBdZcLpG20suI8D9jfvWalv+4murFXzLFeUEMArU=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To: References:From:To:Cc; b=Wsj9YdJkAjsehqaqCJQFJ+YivCqsdbQqQc4m90HW4atQjgb7TIR2jo0iV0djiAHFb 6RthrTvzNlNO3DTaPYGzS8+lGbYxsyA52UZSgR49CLGmIJwbsuaq0rwCFNVFicZpHx 0lAyqHLIPNXfNl+fClcdoA1sgh+Fd2LLaKNEUrlhAKGoGAWOu63FrS/kx/aH7qdchH UGAZ9gwT4Sy6ixRk/4bC1IlGARduv2FQKL8J4MelsZ0h3OcXB9QO1y2HB5XLzPsBO6 P3SgGOSnROeI9tG5rirYAUv3wMLiscANewkDeGkerKr0wGjP3SR2adtwLsXt+CNAnb x9UyS21DluajA== In-Reply-To: <87sft27u4r.fsf@elite.giraud> Received-SPF: pass client-ip=185.70.43.18; envelope-from=goncholden@protonmail.com; helo=mail-4318.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, 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:135622 Archived-At: On Tuesday, February 1st, 2022 at 10:34 AM, Manuel Giraud 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 lig= ht or dark theme. Is the light and dark setting inherent to emacs, or inhe= rent 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 ins= tance of modus-themes. Meaning that the colours are set for any theme one = could be using. > -- > > Manuel Giraud