~protesilaos/modus-themes

3 2

isearch face and variable pitch text

Augusto Stoffel <arstoffel@gmail.com>
Details
Message ID
<87sfnbswe9.fsf@gmail.com>
DKIM signature
missing
Download raw message
The isearch face is bold by default, but lazy-highlight is not.  This
means that in a buffer with variable pitch text, jumping around isearch
matches always makes some text move around a bit to accommodate the
extra width of the bold characters.

More generally, I think it would be better to avoid bold for faces used
in short-lived overlays, at least those where it's not more or less
guaranteed that the underlying face is monospaced.
Details
Message ID
<874jzrdd7c.fsf@protesilaos.com>
In-Reply-To
<87sfnbswe9.fsf@gmail.com> (view parent)
DKIM signature
missing
Download raw message
Patch: +4 -8
> From: Augusto Stoffel <arstoffel@gmail.com>
> Date: Fri, 08 Jul 2022 12:59:10 +0200

Hello Augusto,

> The isearch face is bold by default, but lazy-highlight is not.  This
> means that in a buffer with variable pitch text, jumping around isearch
> matches always makes some text move around a bit to accommodate the
> extra width of the bold characters.
>
> More generally, I think it would be better to avoid bold for faces used
> in short-lived overlays, at least those where it's not more or less
> guaranteed that the underlying face is monospaced.

Yes, I see the problem.  The use of bold was never an optimal solution.
The idea was to increase the distinction between the current and the
lazy highlights without amplifying their respective colours.  However,
that decision was taken in the early days of the project.  Now we have
more (and more refined) colours.

I thus recommend a bigger change than just removing the 'bold'. The diff
below captures the idea, though there are more faces that I will update.
The intent is:

1. Use a yellow colour for the current search match instead of green (or
   blue when 'modus-themes-deuteranopia' is non-nil).  And a red for the
   active match of 'M-x query-replace'.

2. Desaturate the lazy highlights, while keeping their cyan/cool
   impression intact.  We want these to remain distinct from the 'match'
   face, but also from the 'region' (it is possible to expand a region
   with a search).

The use of those colours eliminates the need to test for the value of
'modus-themes-deuteranopia', as they are equally legible for users with
and without red-green colour deficiency.

I post this here in case you or someone else has any further thoughts.
I will make the requisite changes to the other faces and push everything
later.

All the best,
Protesilaos (or simply "Prot")



 modus-themes.el | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/modus-themes.el b/modus-themes.el
index db20b71..1cc66a5 100644
--- a/modus-themes.el
+++ b/modus-themes.el
@@ -4266,12 +4266,8 @@ ;;;;; markup
      ((,class ,@(modus-themes--markup magenta-alt magenta-intense bg-alt
                                       bg-special-faint-calm))))
;;;;; search
    `(modus-themes-search-success ((,class :inherit ,@(modus-themes--deuteran
                                                       'modus-themes-intense-blue
                                                       'modus-themes-intense-green))))
    `(modus-themes-search-success-lazy ((,class :inherit ,@(modus-themes--deuteran
                                                            'modus-themes-special-mild
                                                            'modus-themes-refine-cyan))))
    `(modus-themes-search-success ((,class :inherit modus-themes-intense-yellow)))
    `(modus-themes-search-success-lazy ((,class :inherit modus-themes-special-cold)))
    `(modus-themes-search-success-modeline ((,class :foreground ,@(modus-themes--deuteran
                                                                   blue-active
                                                                   green-active))))
@@ -5858,13 +5854,13 @@ ;;;;; ioccur
    `(ioccur-regexp-face ((,class :inherit (modus-themes-intense-magenta bold))))
    `(ioccur-title-face ((,class :inherit modus-themes-pseudo-header :foreground ,fg-special-cold)))
;;;;; isearch, occur, and the like
    `(isearch ((,class :inherit (modus-themes-search-success bold))))
    `(isearch ((,class :inherit modus-themes-search-success)))
    `(isearch-fail ((,class :inherit modus-themes-refine-red)))
    `(isearch-group-1 ((,class :inherit modus-themes-refine-blue)))
    `(isearch-group-2 ((,class :inherit modus-themes-refine-magenta)))
    `(lazy-highlight ((,class :inherit modus-themes-search-success-lazy)))
    `(match ((,class :inherit modus-themes-special-calm)))
    `(query-replace ((,class :inherit (modus-themes-intense-yellow bold))))
    `(query-replace ((,class :inherit modus-themes-intense-red)))
;;;;; ivy
    `(ivy-action ((,class :inherit modus-themes-key-binding)))
    `(ivy-confirm-face ((,class :inherit success)))


-- 
Protesilaos Stavrou
https://protesilaos.com
Details
Message ID
<m1a69jlp5c.fsf@christiantietze.de>
In-Reply-To
<874jzrdd7c.fsf@protesilaos.com> (view parent)
DKIM signature
missing
Download raw message
My non-matching personal preference for colors aside, macOS is, if nothing else, rich in contrast when it comes to search result overlays: the current search result is popped to the foreground with black-on-yellow text in light mode, and the rest is toned-down. Other matches retain their default colors, so black-on-white (or whichever color the text had before). So essentially everything becomes black on gray, except for matches.
Details
Message ID
<87zghjbuoe.fsf@protesilaos.com>
In-Reply-To
<m1a69jlp5c.fsf@christiantietze.de> (view parent)
DKIM signature
missing
Download raw message
> From: Christian Tietze <me@christiantietze.de>
> Date: Fri, 08 Jul 2022 15:17:35 +0200
>
> My non-matching personal preference for colors aside, macOS is, if
> nothing else, rich in contrast when it comes to search result
> overlays: the current search result is popped to the foreground with
> black-on-yellow text in light mode, and the rest is toned-down. Other
> matches retain their default colors, so black-on-white (or whichever
> color the text had before). So essentially everything becomes black on
> gray, except for matches.
>
> This has one major upside: the matches really stand out.

Thank you, Christian!

Indeed, the matches do stand out that way.  While we cannot change
Emacs' behaviour here, I did update the colours in the latest commits.
I have also chosen yellow for current matches.  It is black on yellow
for the light theme and white on yellow/orange for the dark theme.  The
lazy highlights are cyan, though a more desaturated variant than what
was used before.  The core idea is noted here (just noticed some
typos...):

    commit c0c542a57353d36645e12cb3108cd9da14e6bc13
    Author: Protesilaos Stavrou <info@protesilaos.com>
    Date:   Fri Jul 8 15:14:58 2022 +0300

        REVISE current and lazy search colours

        The previous combinations were not optimal, as the default green and
        cyan are too close to each other.  Depending on factors such
        environmental lighting and the quality of the monitor, green and cyan
        may be indistinguishable.

        The previous combinations was also not ideal when the user option
        'modus-themes-deuteranopia' was set to a non-nil value: blue compared to
        a subtle teal can also be problematic under certain circumstances.

        The new colours (intense yellow for active matches and cool/cyan for
        lazy ones) are complementary, meaning that there are naturally easy to
        tell apart.  These specific hues are also well-suited for users with
        red-green colour deficiency: yellow stays as-is, while the cool colour
        becomes a bit more grey though remains distinct.  As such, we do not
        need to run the helper function 'modus-themes--deuteran' to set the
        style based on the value of 'modus-themes-deuteranopia'.

        The new colours do not clash with the style of the 'match' face, nor
        with the various permutations of the 'region' face (subject to the user
        option 'modus-themes-region').

     modus-themes.el | 8 ++------
     1 file changed, 2 insertions(+), 6 deletions(-)

Please check the latest commit though, as I made other changes beside
this one.

-- 
Protesilaos Stavrou
https://protesilaos.com
Reply to thread Export thread (mbox)