From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?iso-8859-1?Q?Jan_Dj=E4rv?= Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Re: About the :distant-foreground face attribute Date: Mon, 13 Jan 2014 17:33:59 +0100 Message-ID: <8E16225F-53EF-498A-AB35-66EB9B33B859@swipnet.se> References: <87bnzo9cja.fsf@gnu.org> <59B7E7FC-48D0-4737-B1BB-FFAC5BA9E07A@swipnet.se> <874n5f3162.fsf@gnu.org> <83fvozf86g.fsf@gnu.org> <87r48javwe.fsf@gnu.org> <83bnzmfjxe.fsf@gnu.org> <52D3E689.6050902@dancol.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 7.1 \(1827\)) Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1389630871 3413 80.91.229.3 (13 Jan 2014 16:34:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 13 Jan 2014 16:34:31 +0000 (UTC) Cc: Eli Zaretskii , Chong Yidong , emacs-devel To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 13 17:34:35 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 1W2kTA-0006K1-Ve for ged-emacs-devel@m.gmane.org; Mon, 13 Jan 2014 17:34:33 +0100 Original-Received: from localhost ([::1]:43476 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2kTA-0004OL-Iy for ged-emacs-devel@m.gmane.org; Mon, 13 Jan 2014 11:34:32 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55029) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2kT0-0004NR-OC for emacs-devel@gnu.org; Mon, 13 Jan 2014 11:34:29 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W2kSu-0008Vt-CN for emacs-devel@gnu.org; Mon, 13 Jan 2014 11:34:22 -0500 Original-Received: from mailfe03.swip.net ([212.247.154.65]:41066 helo=swip.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2kSg-0008TO-DH; Mon, 13 Jan 2014 11:34:02 -0500 X-T2-Spam-Status: No, hits=0.8 required=5.0 tests=BAYES_50 Original-Received: from hosdjarv.se (account mj138573@tele2.se [46.59.42.57] verified) by mailfe03.swip.net (CommuniGate Pro SMTP 5.4.4) with ESMTPA id 301041407; Mon, 13 Jan 2014 17:33:59 +0100 In-Reply-To: <52D3E689.6050902@dancol.org> X-Mailer: Apple Mail (2.1827) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 212.247.154.65 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:168300 Archived-At: Hello. 13 jan 2014 kl. 14:13 skrev Daniel Colascione : > The attached patch might be another solution to the problem. It = replaces :distant-foreground with :contrast-function, which punts the = actual contrast logic to lisp by calling the named function during face = realization. (Performance isn't a problem in practice because we cache = face realizations.) In lisp, we implement four low-contrast-mitigation = policies: do not adjust for contrast, adjust automatically (by adjusting = CIE L*A*B color space L values), adjust automatically (by adjusting the = V values in HSV color space), or just set the foreground to a specific = color if the contrast dips below a certain point (the current = :distant-foreground behavior). Both the policy and the parameters (well, = the override color) are customizable on a per-face basis; when merging = faces, the one with the highest priority sets the whole behavior. The main complaint (as I see it) was that a new attribute was added. So = does this. >=20 > The patch uses the CIE L*A*B colorspace algorithm by default. Do not change the defaults please. Reinstate the *_selection_fg_color. = They are system defined and should be honored. > It produces surprisingly good results, at least in my tests, adapting = automatically to light and dark backgrounds while preserving the hues of = theme foreground colors. >=20 > (Changing themes nukes the face property right now, so you'll have to = reset it each time.) > @@ -1070,7 +1070,8 @@ (:foreground . "foreground color") (:background . "background color") (:stipple . "background stipple") - (:inherit . "inheritance")) + (:inherit . "inheritance") + (:contrast-function "contrast function")) "An alist of descriptive names for face attributes. Each element has the form (ATTRIBUTE-NAME . DESCRIPTION) where ATTRIBUTE-NAME is a face attribute name (a keyword symbol), and @@ -1351,7 +1352,6 @@ There is a . missing after :contrast-function. Have you checked that no event handling code accesses a face = fore/background? You can not call a lisp function in that context. Jan D.