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

(This is a www-style conversation. I've added www-svg as a bcc to bring it
to the attention of SVG folks, but discussion should stay on www-style if
possible.)

Relevant:

SVG 2 introduced text-decoration-fill and text-decoration-stroke
properties, as analogues to text-decoration-color for painted SVG text.

https://www.w3.org/TR/SVG2/text.html#TextDecorationFillStroke

I honestly had never carefully read that section of the spec.  It's a mess
(initial: see prose! inherited: see prose!).

Current behavior is to use whatever values are set for `fill` and `stroke`
on the text.  But there are no keywords that represent those values (which
can be paint servers instead of simple colors).

That new SVG 2 section suggests using `text-decoration-color` as the
`text-decoration-fill` value *if *t-d-color is explicitly specified and
t-d-fill is not.  But that assumes that there is an initial value of
`text-decoration-color` that can be distinguished from a valid color.  This
doesn't work if the initial value is just `currentColor`.

Perhaps both issues (SVG fill/stroke and -webkit-text-fill/stroke) can be
addressed by defining an initial `auto` or `match-text` value for
`text-decoration-color` that essentially says "paint the text decoration
with whatever styles you're using to paint the main text."
 `text-decoration-fill` and `text-decoration-stroke` would also need some
sort of auto keywords, which for -fill could still fallback to t-d-color,
and only to the original fill if t-d-color computed to auto/match-text.

~Amelia



On 22 December 2016 at 14:52, L. David Baron <dbaron@dbaron.org> 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.
>
> -David
>
>

Received on Friday, 23 December 2016 01:00:22 UTC