emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tab-line-alternate-colors


From: Adam Porter
Subject: Re: [PATCH] tab-line-alternate-colors
Date: Sun, 13 Dec 2020 20:17:28 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>> +(defface tab-line-tab-inactive-alternate
>> +  (let ((mode-line-bg (face-background 'mode-line nil t)))
>> +    `((t (:inherit tab-line-tab-inactive :background ,mode-line-bg))))
>
> Is this supposed to change the background when that of the mode line
> changes, or is it supposed to keep the original one, recorded when
> this defface is processed?

This is the default definition of the face, so it would not be updated
if the mode-line face changes (e.g. when a theme is loaded).  That's not
ideal, of course.

I know of two alternatives:

1.  Use an anonymous face computed at runtime (e.g. by calling
color-darken-name on the tab-line face's background color).  That would
seem wasteful, considering how often these functions are called.

2.  Define the face with a specific color.  That would work for the
default theme, but when other themes are loaded, the colors would
usually clash, and that would require themes to add support for the new
face.

> More generally, why use such an unusual definition of a face?

In the default theme, the mode-line face has a background color that's
slightly darker than the header-line face's (and therefore the tab-line
face's) background color, so it seems like a suitable color for
alternating tabs' background color.  For themes that follow the pattern
of the header-line and mode-line having different background colors, it
should work without requiring themes to support a new face.  So it
seemed preferable to hard-coding the default for the new face.

AFAIK there's no way to inherit only a certain attribute of a face,
other than using an anonymous face made at runtime.  If there were, it
would be simple to just inherit the mode-line face's background color.

>> +(defface tab-line-tab-special '((t (:slant italic)))
>
> What will this do on terminals that don''t support italic?

Nothing, I suppose.  :)  I don't often use Emacs in a terminal, so I'm
not as familiar with that issue.

I'll be glad to follow whatever guidance you may provide here.  Thanks.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]