|
From: | Daniel Colascione |
Subject: | Re: [PATCH] Re: About the :distant-foreground face attribute |
Date: | Mon, 13 Jan 2014 16:07:49 -0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
On 01/13/2014 03:57 PM, Stefan Monnier wrote:
If you want the :distant-foreground behavior, it can be accommodated in this patch. This patch also permits other schemes that some users might find more useful. We should push policy to user customization when possible instead of hardcoding policy in the logic of face attributes.FWIW, I like the idea of being able to compute the color dynamically. I also would welcome a way to specify "color filters", e.g. a face which "darkens the foreground color". IOW the equivalent of the floating-point :height settings, but for colors.
You can write something like that in my setup --- we actually call :contrast-function on every face realization. There's no reason it has to act only on certain conditions, although that's what all the existing implementations do.
We could generalize the mechanism --- maybe we could rename :contrast-function to :filter. Then, in merge_face_vectors, we call the supplied filter function with a vector (or alist?) of face attributes. It returns the new set of attributes and we use those instead of the ones we came up with. The filter function could use `color-values' to get RGB information from the raw face color attributes.
Doing this on every face lookup would probably be too expensive, but maybe we can (in face_at_buffer_position) first compute properties without filters and look that up in the cache. If we don't find it, we can then compute the properties again, this time applying filters, and cache the result.
[Prev in Thread] | Current Thread | [Next in Thread] |