[css-color][compat][css-text-decor] Are more variants of currentcolor needed?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[css-color][compat][css-text-decor] Are more variants of currentcolor needed?

L. David Baron
So the spec for the currentcolor:
https://drafts.csswg.org/css-color-4/#currentcolor-color
says that currentcolor represents the value of the 'color' property.

The text-emphasis-color and text-decoration-color properties:
https://drafts.csswg.org/css-text-decor-3/#propdef-text-emphasis-color
https://drafts.csswg.org/css-text-decor-3/#propdef-text-decoration-color
use currentcolor as their initial value.

However, the compat spec introduces a -webkit-text-fill-color
property that overrides the color of text:
https://compat.spec.whatwg.org/#the-webkit-text-fill-color
which has proven to be needed for compatibily.  I believe Edge has
implemented it, and Gecko has an implementation and is working on
implementing the full set of changes needed to ship that
implementation.

In Chromium (and I presume WebKit, although I didn't test), the
-webkit-text-fill-color property also influences the color of
text-decorations.  See this test:
http://dbaron.org/css/test/2016/currentcolor

I presume that it should also influence the color of text-emphasis,
although neither Chromium nor Edge appears to implement
text-emphasis, and the patches to Gecko so far haven't done this
(although I think they should).

How should this be handled?  I see a few options:

 (1) Say that the 'currentcolor' value has different meaning for
 text-decoration-color and text-emphasis-color, and for those
 properties uses '-webkit-text-fill-color' instead of 'color'.

 (2) Introduce a new value, such as 'current-text-color' or
 'current-text-fill-color' (maybe without hyphens‽) that is the
 initial value of 'text-decoration-color' and 'text-emphasis-color'.

Again, I wrote a few tests for this at:
http://dbaron.org/css/test/2016/currentcolor
although I think more could probably be added.

-David

--
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                          https://www.mozilla.org/   𝄂
             Before I built a wall I'd ask to know
             What I was walling in or walling out,
             And to whom I was like to give offense.
               - Robert Frost, Mending Wall (1914)

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [css-color][compat][css-text-decor] Are more variants of currentcolor needed?

Tab Atkins Jr.
On Fri, Apr 22, 2016 at 1:48 PM, L. David Baron <[hidden email]> wrote:

> So the spec for the currentcolor:
> https://drafts.csswg.org/css-color-4/#currentcolor-color
> says that currentcolor represents the value of the 'color' property.
>
> The text-emphasis-color and text-decoration-color properties:
> https://drafts.csswg.org/css-text-decor-3/#propdef-text-emphasis-color
> https://drafts.csswg.org/css-text-decor-3/#propdef-text-decoration-color
> use currentcolor as their initial value.
>
> However, the compat spec introduces a -webkit-text-fill-color
> property that overrides the color of text:
> https://compat.spec.whatwg.org/#the-webkit-text-fill-color
> which has proven to be needed for compatibily.  I believe Edge has
> implemented it, and Gecko has an implementation and is working on
> implementing the full set of changes needed to ship that
> implementation.
>
> In Chromium (and I presume WebKit, although I didn't test), the
> -webkit-text-fill-color property also influences the color of
> text-decorations.  See this test:
> http://dbaron.org/css/test/2016/currentcolor
>
> I presume that it should also influence the color of text-emphasis,
> although neither Chromium nor Edge appears to implement
> text-emphasis, and the patches to Gecko so far haven't done this
> (although I think they should).
>
> How should this be handled?  I see a few options:
>
>  (1) Say that the 'currentcolor' value has different meaning for
>  text-decoration-color and text-emphasis-color, and for those
>  properties uses '-webkit-text-fill-color' instead of 'color'.
>
>  (2) Introduce a new value, such as 'current-text-color' or
>  'current-text-fill-color' (maybe without hyphens‽) that is the
>  initial value of 'text-decoration-color' and 'text-emphasis-color'.
>
> Again, I wrote a few tests for this at:
> http://dbaron.org/css/test/2016/currentcolor
> although I think more could probably be added.

Surely there's a (3) See if WK/Blink can change their behavior to make
text-decorations follow 'color' by default rather than
'text-fill-color'?

~TJ

Reply | Threaded
Open this post in threaded view
|

Re: [css-color][compat][css-text-decor] Are more variants of currentcolor needed?

Xidorn Quan-2
On Sat, Apr 23, 2016, at 07:50 AM, Tab Atkins Jr. wrote:

> On Fri, Apr 22, 2016 at 1:48 PM, L. David Baron <[hidden email]>
> wrote:
> > So the spec for the currentcolor:
> > https://drafts.csswg.org/css-color-4/#currentcolor-color
> > says that currentcolor represents the value of the 'color' property.
> >
> > The text-emphasis-color and text-decoration-color properties:
> > https://drafts.csswg.org/css-text-decor-3/#propdef-text-emphasis-color
> > https://drafts.csswg.org/css-text-decor-3/#propdef-text-decoration-color
> > use currentcolor as their initial value.
> >
> > However, the compat spec introduces a -webkit-text-fill-color
> > property that overrides the color of text:
> > https://compat.spec.whatwg.org/#the-webkit-text-fill-color
> > which has proven to be needed for compatibily.  I believe Edge has
> > implemented it, and Gecko has an implementation and is working on
> > implementing the full set of changes needed to ship that
> > implementation.
> >
> > In Chromium (and I presume WebKit, although I didn't test), the
> > -webkit-text-fill-color property also influences the color of
> > text-decorations.  See this test:
> > http://dbaron.org/css/test/2016/currentcolor
> >
> > I presume that it should also influence the color of text-emphasis,
> > although neither Chromium nor Edge appears to implement
> > text-emphasis, and the patches to Gecko so far haven't done this
> > (although I think they should).
> >
> > How should this be handled?  I see a few options:
> >
> >  (1) Say that the 'currentcolor' value has different meaning for
> >  text-decoration-color and text-emphasis-color, and for those
> >  properties uses '-webkit-text-fill-color' instead of 'color'.
> >
> >  (2) Introduce a new value, such as 'current-text-color' or
> >  'current-text-fill-color' (maybe without hyphens‽) that is the
> >  initial value of 'text-decoration-color' and 'text-emphasis-color'.
> >
> > Again, I wrote a few tests for this at:
> > http://dbaron.org/css/test/2016/currentcolor
> > although I think more could probably be added.
>
> Surely there's a (3) See if WK/Blink can change their behavior to make
> text-decorations follow 'color' by default rather than
> 'text-fill-color'?
>
> ~TJ

I totally agree with (3). I don't think we should mess up currentcolor
value, especially considering the existing issue around interpolation. I
suspect that (1) and (2) would again add complexity of implementing the
blend() function proposed by Tab in the other thread.

- Xidorn

Reply | Threaded
Open this post in threaded view
|

Re: [css-color][compat][css-text-decor] Are more variants of currentcolor needed?

Koji Ishii


2016/04/23 午前7:26 "Xidorn Quan" <[hidden email]>:
>
> On Sat, Apr 23, 2016, at 07:50 AM, Tab Atkins Jr. wrote:
> > On Fri, Apr 22, 2016 at 1:48 PM, L. David Baron <[hidden email]>
> > wrote:
> > >
> > > I presume that it should also influence the color of text-emphasis,
> > > although neither Chromium nor Edge appears to implement
> > > text-emphasis, and the patches to Gecko so far haven't done this
> > > (although I think they should).

Chromium supports -webkit-text-emphasis. It looks like it's the value of 'color'.

/koji

Reply | Threaded
Open this post in threaded view
|

Re: [css-color][compat][css-text-decor] Are more variants of currentcolor needed?

Tab Atkins Jr.
On Mon, Apr 25, 2016 at 2:15 AM, Koji Ishii <[hidden email]> wrote:

> 2016/04/23 午前7:26 "Xidorn Quan" <[hidden email]>:
>> On Sat, Apr 23, 2016, at 07:50 AM, Tab Atkins Jr. wrote:
>> > On Fri, Apr 22, 2016 at 1:48 PM, L. David Baron <[hidden email]>
>> > wrote:
>> > >
>> > > I presume that it should also influence the color of text-emphasis,
>> > > although neither Chromium nor Edge appears to implement
>> > > text-emphasis, and the patches to Gecko so far haven't done this
>> > > (although I think they should).
>
> Chromium supports -webkit-text-emphasis. It looks like it's the value of
> 'color'.

Confirmed, it treats currentcolor as referring to 'color'.

This indicates that we're just a mishmash, and should converge on one
or the other, preferably 'color'.

~TJ

Reply | Threaded
Open this post in threaded view
|

Re: [css-color][compat][css-text-decor] Are more variants of currentcolor needed?

Jonathan Kew
On 25/4/16 15:35, Tab Atkins Jr. wrote:

> On Mon, Apr 25, 2016 at 2:15 AM, Koji Ishii <[hidden email]> wrote:
>> 2016/04/23 午前7:26 "Xidorn Quan" <[hidden email]>:
>>> On Sat, Apr 23, 2016, at 07:50 AM, Tab Atkins Jr. wrote:
>>>> On Fri, Apr 22, 2016 at 1:48 PM, L. David Baron <[hidden email]>
>>>> wrote:
>>>>>
>>>>> I presume that it should also influence the color of text-emphasis,
>>>>> although neither Chromium nor Edge appears to implement
>>>>> text-emphasis, and the patches to Gecko so far haven't done this
>>>>> (although I think they should).
>>
>> Chromium supports -webkit-text-emphasis. It looks like it's the value of
>> 'color'.
>
> Confirmed, it treats currentcolor as referring to 'color'.
>
> This indicates that we're just a mishmash, and should converge on one
> or the other, preferably 'color'.

While we're thinking about this, how about text-decoration-color?

https://www.w3.org/TR/css-text-decor-3/#text-decoration-color-property 
says that its initial value is also 'currentColor'.

AFAICS, Chrome & Safari don't currently support this as a CSS property,
but their behavior implies that if they did, it would be...kinda weird.
Consider these examples:

(a)
data:text/html,<div style="color:blue;
                            -webkit-text-fill-color:green">hello <u>world

(b)
data:text/html,<div style="color:blue;
                            -webkit-text-fill-color:green;
                            -webkit-text-stroke-color:red">hello <u>world

(c)
data:text/html,<div style="color:blue;
                            -webkit-text-fill-color:green;
                            -webkit-text-stroke-color:red;
                            -webkit-text-stroke-width:1px">hello <u>world

Can you guess the color of the underline on "world" in each case?

The answers I get in current Chrome and Safari are (a) green; (b) green;
(c) red.

In other words, the used text-decoration-color seems to follow
'-webkit-text-fill-color' (not 'color'), _unless_
'-webkit-text-stroke-width' is greater than zero, in which case it
follows '-webkit-text-stroke-color' instead.

Please, can we reconsider that and go with something less quirky? (FWIW,
latest Firefox Nightly gives a green underline in all three cases.)

JK


Reply | Threaded
Open this post in threaded view
|

Re: [css-color][compat][css-text-decor] Are more variants of currentcolor needed?

Tab Atkins Jr.
On Mon, Apr 25, 2016 at 8:48 AM, Jonathan Kew <[hidden email]> wrote:
> While we're thinking about this, how about text-decoration-color?

This was tested in dbaron's original testcase.  Yes, Chrome/Safari do
weird stuff there, making it read the value of text-fill-color
instead.

~TJ

Reply | Threaded
Open this post in threaded view
|

Re: [css-color][compat][css-text-decor] Are more variants of currentcolor needed?

Jonathan Kew
On 25/4/16 18:06, Tab Atkins Jr. wrote:
> On Mon, Apr 25, 2016 at 8:48 AM, Jonathan Kew <[hidden email]> wrote:
>> While we're thinking about this, how about text-decoration-color?
>
> This was tested in dbaron's original testcase.  Yes, Chrome/Safari do
> weird stuff there, making it read the value of text-fill-color
> instead.

...except when they switch to using text-stroke-color; that's the part I
found particularly curious/unexpected (and the original testcase didn't
try adding text-stroke to the mix, afaics).

JK