From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Adam Porter Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] tab-line-alternate-colors Date: Sun, 13 Dec 2020 20:17:28 -0600 Message-ID: <87lfe1t9l3.fsf@alphapapa.net> References: <87360autpy.fsf@alphapapa.net> <87mtyiqfzv.fsf@mail.linkov.net> <87tusqt3yr.fsf@alphapapa.net> <834kkpenox.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3048"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Dec 14 03:18:18 2020 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 1kodRK-0000hY-R1 for ged-emacs-devel@m.gmane-mx.org; Mon, 14 Dec 2020 03:18:18 +0100 Original-Received: from localhost ([::1]:54752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kodRJ-0008Ra-Tx for ged-emacs-devel@m.gmane-mx.org; Sun, 13 Dec 2020 21:18:17 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kodQl-00082y-DY for emacs-devel@gnu.org; Sun, 13 Dec 2020 21:17:43 -0500 Original-Received: from static.214.254.202.116.clients.your-server.de ([116.202.254.214]:37400 helo=ciao.gmane.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kodQg-0004zr-OL for emacs-devel@gnu.org; Sun, 13 Dec 2020 21:17:39 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1kodQc-000ASb-MX for emacs-devel@gnu.org; Mon, 14 Dec 2020 03:17:34 +0100 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.devel:260783 Archived-At: Eli Zaretskii 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.