all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Filippo Argiolas <filippo.argiolas@gmail.com>
To: Drew Adams <drew.adams@oracle.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
	"emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Re: [External] : Re: Foreground color opacity
Date: Mon, 11 Sep 2023 18:08:51 +0200	[thread overview]
Message-ID: <CAOdrLGLwSywvrR2Z8_BZQcSjV5nDQBrbDgTWNJL4t5qesqMc0A@mail.gmail.com> (raw)
In-Reply-To: <SJ0PR10MB548878EF81A62D743D9CA339F3F2A@SJ0PR10MB5488.namprd10.prod.outlook.com>

On Mon, Sep 11, 2023 at 4:58 PM Drew Adams <drew.adams@oracle.com> 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 later.
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



  reply	other threads:[~2023-09-11 16:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-11 10:45 Foreground color opacity Filippo Argiolas
2023-09-11 12:58 ` Eli Zaretskii
2023-09-11 13:09   ` Filippo Argiolas
2023-09-11 14:04     ` Eli Zaretskii
2023-09-11 14:58       ` [External] : " Drew Adams
2023-09-11 16:08         ` Filippo Argiolas [this message]
2023-09-11 16:25       ` Filippo Argiolas
2023-09-11 16:56         ` Eli Zaretskii
2023-09-11 19:00           ` Filippo Argiolas
2023-09-12  2:21             ` Eli Zaretskii
2023-09-12  4:55               ` Filippo Argiolas
2023-09-12  5:24                 ` Filippo Argiolas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOdrLGLwSywvrR2Z8_BZQcSjV5nDQBrbDgTWNJL4t5qesqMc0A@mail.gmail.com \
    --to=filippo.argiolas@gmail.com \
    --cc=drew.adams@oracle.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.