W3C home > Mailing lists > Public > www-style@w3.org > December 2016

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

From: Xidorn Quan <me@upsuper.org>
Date: Sun, 25 Dec 2016 13:01:22 +1100
Message-Id: <1482631282.1082217.829013257.3B3AF0BA@webmail.messagingengine.com>
To: www-style@w3.org
On Fri, Dec 23, 2016, at 08:52 AM, L. David Baron wrote:
> On Friday 2016-04-22 14:50 -0700, Tab Atkins Jr. wrote:
> > On Fri, Apr 22, 2016 at 1:48 PM, L. David Baron <dbaron@dbaron.org> 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'?
> 
> But if you're going to have a text-fill-color property (to change
> the color of text without changing the various other things that
> depend on 'color'), you probably want text-decorations and
> text-emphasis to follow it, since they're basically part of the text.

I don't think so.

In your example, at least in Safari, text-emphasis follows "color"
property by default, rather than "text-fill-color". (And Blink doesn't
have unprefixed text-emphasis yet so I didn't test). Their underline is
shown in color of "text-fill-color" but WK/Blink don't have a separate
"text-decoration-color" yet, so I think they should make decoration
lines follow "color" when they implement that property.

"-webkit-text-fill-color" was introduced for "backward" compatibility
with browsers don't support "background-clip: text", so
"-webkit-text-fill-color" in practice is usually just "transparent", and
ironically, if you use "-webkit-text-fill-color: transparent" in your
example with background-clip, you can see that the decoration line
disappears. (Gecko has the same behavior if you set "color" to
"transparent".) So having decoration color follow
"-webkit-text-fill-color" doesn't actually make any sense in practice
either.

Since all major browsers now implements "-webkit-background-clip: text",
there is basically no practical reason to use "-webkit-text-fill-color"
anymore, and thus I don't expect that people want to change text color
but not "color" property. And if they really choose to do that, I would
suggest we don't do too much "clever" things on top of that.

I'd still like to see "text-fill-color" to be put in CSS spec, though,
to officially make "color" property purely a builtin variable :)

- Xidorn
Received on Sunday, 25 December 2016 02:01:47 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:09:05 UTC