[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [External] : Re: Foreground color opacity
From: |
Drew Adams |
Subject: |
RE: [External] : Re: Foreground color opacity |
Date: |
Mon, 11 Sep 2023 14:58:30 +0000 |
> > > Why not cover the "inactive" portion with an overlay which has the
> > > 'face' (or font-lock-face) property that specifies only the opacity?
> > > That is IMO simpler and doesn't need to run any functions after
> > > fontifications.
> > > (Caveat: I didn't actually try this approach, so maybe I'm missing
> > > something.)
> >
> > That would be the perfect solution, but as far as I can tell we don't
> > have an opacity face attribute, do we?
>
> Too bad. (The alpha parameter is what I had in mind , but I see now
> that it's only supported for the entire frame, not for a single face.)
>
> Anyway, it sounds inelegant that we need to jump through such hoops to
> achieve such a simple effect. It could even be a problem, if some
> Lisp program expects to find the font-lock faces in a buffer, but
> instead sees your special faces which replaced them. E.g., don't we
> have features that detect strings and comments in code by looking for
> their respective font-lock faces?
I agree that an alpha face attribute would be a good thing.
___
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
___
HTH.
- Foreground color opacity, Filippo Argiolas, 2023/09/11
- Re: Foreground color opacity, Eli Zaretskii, 2023/09/11
- Re: Foreground color opacity, Filippo Argiolas, 2023/09/11
- Re: Foreground color opacity, Filippo Argiolas, 2023/09/11
- Re: Foreground color opacity, Eli Zaretskii, 2023/09/11
- Re: Foreground color opacity, Filippo Argiolas, 2023/09/11
- Re: Foreground color opacity, Eli Zaretskii, 2023/09/11
- Re: Foreground color opacity, Filippo Argiolas, 2023/09/12
- Re: Foreground color opacity, Filippo Argiolas, 2023/09/12