RE: -webkit-background-clip:text and -webkit-text-fill-color?

There's another use case that might be interesting as well.

Color can influence other *-color properties via currentColor.  As such, you can do things like...
 div {
  color: red;
  border-color: currentColor;
  box-shadow: 10px 10px 5px currentColor;
 }

There are times when it would be nice to have this as well:
 div {
  color: teal;
  border-color: currentColor;
  background-color: currentColor;
  text-color: blue;
 }

With the introduction of text-color (with an initial value of currentColor), properties names such as text-image naturally come to mind.

Foreground-color, text-color... something like that.
 
-Brian

-----Original Message-----
From: Tab Atkins Jr. [mailto:jackalmage@gmail.com] 
Sent: Thursday, May 31, 2012 3:37 PM
To: Marat Tanalin | tanalin.com
Cc: Jared Wein; www-style@w3.org
Subject: Re: -webkit-background-clip:text and -webkit-text-fill-color?

On Thu, May 31, 2012 at 2:35 PM, Marat Tanalin | tanalin.com <mtanalin@yandex.ru> wrote:
> 01.06.2012, 00:53, "Tab Atkins Jr." <jackalmage@gmail.com>:
>> On Thu, May 31, 2012 at 10:11 AM, Jared Wein <jwein@mozilla.com> wrote:
>>>  Has there been a proposal from the Webkit authors for -webkit-background-clip:text and -webkit-text-fill-color?
>>>
>>>  I think properties like these could be useful in other engines.
>>
>> -webkit-background-clip:text is the devil.  It's a very silly misuse 
>> of background-clipping to accomplish a text fill.  I like this 
>> functionality and think that we need it, but this particular 
>> implementation of it is ridiculous.
>
> Are any plans or drafts available for that currently?

Not right now, no.  It's just something that we should obviously have.

>> -webkit-text-fill-color is, as far as I can tell, completely useless.
>> It does literally the exact same thing as 'color'.  I haven't looked 
>> into our codebase to see what it actually accomplishes, but I think 
>> it was just a cargo-cult addition from the SVG model to go along with 
>> -webkit-text-stroke.
>
> AFAIK, `-webkit-text-fill-color` overrides standard `color`. This makes it possible to separately specify two different colors for browsers that do not support `-webkit-background-clip` (standard `color` property is used) and for browsers that do support it (`-webkit-text-fill-color` is used by browser instead of `color`) to keep text readable anyway.

Ah, good point.  It's still a completely idiotic property, but I see why it exists now.  The correct way to do this is, of course, to have a proper fill solution that ignores 'color' when it's specified.  The super-dumb solution of using the background-clip property to hack a text-fill is what made this necessary.

~TJ

Received on Friday, 1 June 2012 02:21:41 UTC