From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: About the :distant-foreground face attribute Date: Wed, 08 Jan 2014 13:24:17 +0800 Message-ID: <87r48javwe.fsf@gnu.org> References: <87bnzo9cja.fsf@gnu.org> <59B7E7FC-48D0-4737-B1BB-FFAC5BA9E07A@swipnet.se> <874n5f3162.fsf@gnu.org> <83fvozf86g.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1389158665 7883 80.91.229.3 (8 Jan 2014 05:24:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 8 Jan 2014 05:24:25 +0000 (UTC) Cc: jan.h.d@swipnet.se, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 08 06:24:32 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W0ld0-0001bZ-Kv for ged-emacs-devel@m.gmane.org; Wed, 08 Jan 2014 06:24:30 +0100 Original-Received: from localhost ([::1]:45091 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0ld0-0003Kl-7P for ged-emacs-devel@m.gmane.org; Wed, 08 Jan 2014 00:24:30 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0lct-0003Aa-Eh for emacs-devel@gnu.org; Wed, 08 Jan 2014 00:24:28 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W0lcn-0006Ec-W0 for emacs-devel@gnu.org; Wed, 08 Jan 2014 00:24:23 -0500 Original-Received: from mail-pa0-x22e.google.com ([2607:f8b0:400e:c03::22e]:39362) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W0lcn-0006ES-OH; Wed, 08 Jan 2014 00:24:17 -0500 Original-Received: by mail-pa0-f46.google.com with SMTP id kp14so1360350pab.5 for ; Tue, 07 Jan 2014 21:24:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=O7w9LfRojiiUid018pkoPHYYXfMuB5hlyqWjvJnKp4g=; b=kkMvuYbMZ2UZLUitFNL+fWJcgz1ZYRiW+RBpJ7zvZU34zDzeGD9JeXbybukTZDes9v NrKyEpKGbEMs3iv56yuVne8/I/XNPyHiWJWX3btN7W2KKZZRfhNdbdN1BVkb/6T2InhE EBnVKjeSwZZwsyoDly9QZ9y3QKGXITwRhEv4+vJwPlX8sYWSWB3oJzkIJSfoMO+GNO7U mZn6RNLYEze5SsE0nizDgn6UDZblqSe3acHa0OIcMtweVb7+rOlKmpkg9OKlUBiXrdJ1 M1pI/Yh8oMPe/KK113WzNvpx1u6+LRCWijCaLcLgknSyhNoCg3N2TWJhF8nnLgiIgzhE X9+A== X-Received: by 10.66.222.234 with SMTP id qp10mr10181425pac.156.1389158656712; Tue, 07 Jan 2014 21:24:16 -0800 (PST) Original-Received: from tsparkle ([65.127.72.2]) by mx.google.com with ESMTPSA id nl7sm140193192pbc.6.2014.01.07.21.24.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Jan 2014 21:24:15 -0800 (PST) In-Reply-To: <83fvozf86g.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 08 Jan 2014 05:45:27 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c03::22e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:167710 Archived-At: Eli Zaretskii writes: >> The feature does not fit well with the design of the rest of the >> face-handling code. We already have a mechanism for checking to see >> when to use a particular face: the DISPLAY element in a face spec. The >> :distant-foreground face attribute, by its very existence, is redundant >> with what the DISPLAY element was meant to do. This adds extra >> complexity to the design, for no good reason. > > I don't understand this criticism. How is this attribute different > from min-colors? The min-colors feature doesn't involve adding an extra face attribute. The analogy would be if there was a :low-color-foreground face attribute which would override :foreground on low-color displays. That would be ugly, as I hope you agree. OK, after poking around a bit I understand the problem better. You want to be free to set face background colors without worrying about making text illegible (which can be difficult to figure out ahead of time, because of face inheritance etc). So here's a proposal: Change the feature so it applies to all faces, but in a configurable way. Introduce a new Lisp variable, `face-minimum-contrast', which specifies the minimum allowed contrast between the background and foreground of any face (or nil, which means to disable the feature). If the contrast of a face is lower than specified, the foreground color is adjusted (say, by changing its V component) to conform to the minimum contrast. This would avoid having to introduce a :distant-foreground attribute for all faces, only to use that attribute for just one face (`region') and for one special purpose (to cope with the GTK selection color). It would handle the generic class of problems involving text becoming illegible, such as due to bad themes.