From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Filippo Argiolas Newsgroups: gmane.emacs.devel Subject: Re: [External] : Re: Foreground color opacity Date: Mon, 11 Sep 2023 18:08:51 +0200 Message-ID: References: <83fs3krhmi.fsf@gnu.org> <838r9crel3.fsf@gnu.org> 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="2588"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , "emacs-devel@gnu.org" To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Sep 11 18:10:03 2023 Return-path: Envelope-to: ged-emacs-devel@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 1qfjUA-0000SW-Ib for ged-emacs-devel@m.gmane-mx.org; Mon, 11 Sep 2023 18:10:02 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfjTK-0007me-AP; Mon, 11 Sep 2023 12:09:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qfjTJ-0007m7-3P for emacs-devel@gnu.org; Mon, 11 Sep 2023 12:09:09 -0400 Original-Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfjTG-0002ws-Gk; Mon, 11 Sep 2023 12:09:08 -0400 Original-Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-68fcb4dc8a9so805949b3a.2; Mon, 11 Sep 2023 09:09:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694448543; x=1695053343; darn=gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=yD1mQ+gcYZnqdzO6100YakpG78Er9n8JE2FH/0vqGeE=; b=bLZmvkqJYUn+dUH6MwSnpksC7PYuEHCr293iIEGKUJRDZoCdaMJRfid19Y2v1qzet0 ce4D5oV58RavWKIlpky8V26x4EjK9ZjSuZ6ST9pKlHQ4dTxgckiKeoEnOLvevRsoyqNd yXR0LjrH4CM0Z56nOXiMPetbB598w9CYa+cVSW+8YZC0hKgSK4RYzOzgUFXUvXCWXM1W JEF+TCGHUOmO+08GDSRH3xmJRioitqcye79Y5ox6Hficb3IbYJ+hYXsx4m0XREDj4Sqj /qQa6IppRWvWr6g+GF6KApyeHa1EUrIB3psHJuDGozvoNAxCMILGlgY4BRrXJGdDa4bj NmyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694448543; x=1695053343; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yD1mQ+gcYZnqdzO6100YakpG78Er9n8JE2FH/0vqGeE=; b=Cku0Y/ZoNXQWcdNYmiinR75+Rypn5JPikj6fyRopmq7ib7sbrHi3HKO1B3hUyro02F 2MBlLO38k2B6s9ZFIA22Ov4xZbFQ7wHKhYiOI50sLmo78RYdul2aJo7+u8OTps4BCMc6 92gDCBsiPO0leWO4PCbFPYSwT2gLCpQq/8srWEnH2nTm+BzW9qdwhZIrNMuaQo6xVV/d tkSkpSDfDTCT2bnWrmt9Jw5+ff4eyCKSyahFhzVYA/sqcogAkL9zKWpAt9YyXiRK3+lo kzrZcGwVfKAs6Tv8bTBjw8aQoo388i4X408+2tu6qj9OCvOufelyuHjTDOPCavg/tZ+U tM8Q== X-Gm-Message-State: AOJu0YzNW7Q/acMOPf6mLJlSwJgJPyFYq3muEiSnWDlfqqPWJeozphU2 FLG6EabaS9o4PquX3L1jwfdT1mWESUlz29kXsnE= X-Google-Smtp-Source: AGHT+IFaQgcqplNIYT+FQHldx43mZjvQcnUmLZXSdbREjZtdKjkwplytrivx0kxAevDSdToL9SAkgl0zb8nLIMOYF9w= X-Received: by 2002:a17:90a:8181:b0:26f:4685:5b69 with SMTP id e1-20020a17090a818100b0026f46855b69mr7878291pjn.7.1694448543415; Mon, 11 Sep 2023 09:09:03 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=filippo.argiolas@gmail.com; helo=mail-pf1-x42c.google.com 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:310472 Archived-At: On Mon, Sep 11, 2023 at 4:58=E2=80=AFPM Drew Adams = wrote: > FWIW, in my library `hl-spotlight.el' I shade/highlight the > background over several lines around the cursor - which is > somewhat similar to the feature Filippo described, at least > wrt dimming/highlighting a zone of text. > > I use an overlay, similar to what Eli suggested. Because in > my case the zone is just some contiguous lines I leverage > `hl-line-mode', substituting a different face for the line > background dimming/highlighting. > > https://www.emacswiki.org/emacs/HighlightCurrentLine#HlSpotlight > ___ > > `hl-spotlight.el' just uses a face for the overlay, leaving > it up to a user to customize that as needed. > > Library `isearch-prop.el' provides similar dimming/lightening > of a zone of text (not necessarily lines). But it lets you > choose whether to use a particular background color or to dim > or lighten the background by a given factor. In the latter > case it uses `color-saturate-name' or `color-lighten-name' > from standard library `color.el' to do the dimming/lightening. > > https://www.emacswiki.org/emacs/download/isearch-prop.el > ___ Thank you, I will definitely better look into your code with more time late= r. At some point I tried using `color-darken-name' but for some reason I forgot I didn't like it and implemented my own color blending function. Will look at it again! Problem is shading the background is kind of easy, with prog modes you can somewhat safely assume [1] it to be constant on the whole fontified buffer. Foreground instead differs for each symbol in a given region so you need to go over them and apply a different shaded face for each one. It would be great to offset this job to the backend and just set an alpha/opacity/whatever attribute in an overlay and let the backend do the shading. Cheers, Filippo 1. kind of expect here to be proved wrong with some funky theme example that sets different backgrounds for each font lock face