W3C home > Mailing lists > Public > www-style@w3.org > August 2009

Re: Gradient syntax proposal

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Mon, 17 Aug 2009 12:46:43 -0500
Message-ID: <dd0fbad0908171046j1f4ae08erffb1c7565f21265f@mail.gmail.com>
To: Brad Kemper <brad.kemper@gmail.com>
Cc: David Perrell <davidp@hpaa.com>, Andrew Fedoniouk <news@terrainformatica.com>, www-style list <www-style@w3.org>
On Mon, Aug 17, 2009 at 12:32 PM, Brad Kemper<brad.kemper@gmail.com> wrote:
> On Aug 17, 2009, at 10:03 AM, "Tab Atkins Jr." <jackalmage@gmail.com> wrote:
>
>> On Mon, Aug 17, 2009 at 10:28 AM, Brad Kemper<brad.kemper@gmail.com>
>> wrote:
>>>
>>> On Aug 16, 2009, at 11:15 PM, David Perrell wrote:
>>>>
>>>> | If you allow lengths and percentages in the same list of color stops,
>>>> | then stops could trade places based on the size of the box they are
>>>> in.
>>>>
>>>> Not if stops are forced to be in ascending order, so if a color-stop
>>>> specifies a position before a previous color-stop, its position is
>>>> changed
>>>> to that of the previous stop. There are situations where that might be
>>>> considered graceful degradation.
>>>
>>> I'm not sure why that is better. Either way, the UA will have to figure
>>> out
>>> where the location will be for each stop before it lays out the
>>> gradation.
>>> I'd prefer to either insist on all units in a gradation being the same
>>> (so
>>> they can be in order without ambiguity), or just let them be out of
>>> order.
>>> If allowed in any order, if you have the following in a 100px height box:
>>>
>>> linear-gradient(top / white, yellow 80px, green, blue 60%, black)
>>>
>>> the used value would be:
>>>
>>> linear-gradient(top / white 0, blue 60px, green 70px, yellow 80px, black
>>> 100%)
>>>
>>> The green would be half way between 80px and 60px (60% of a 100px box).
>>
>> Nah, I really don't think it's acceptable that you have no way of
>> telling where that blue stop is going to be in relation to the others.
>> I'd *much* rather have it become:
>>
>> linear-gradient(top / white 0, yellow 80px, green 80px, blue 80px, black
>> 100%)
>>
>> This completely hides the green and makes a sharp transition from
>> yellow to blue, but if the box gets taller it then cleanly expands the
>> yellow/blue boundary to have a green transition.  Your interpretation
>> would have a white->blue and yellow->black transition when the box was
>> short, but a white->yellow and blue->black transition when the box was
>> tall.  That's almost certainly not what was intended.
>
> Nah, you don't know what was intended. Maybe I wanted the blue to line up
> nicely with the biottom of something else that was 60% of the box height,
> and the yellow to line up with the bottom of a picture first-child, and not
> have colors disappear altogether. It's not as clear-cut to guess the authors
> intentions as you make it out to be.

I can accept that the author genuinely intended to line up the yellow
at 80px and the blue at 60%.  I would be *very* loathe to believe that
this hypothetical author, who's careful enough to line up their colors
like that, would accept that sometimes their gradient goes "white
yellow green blue black", and sometimes goes "white blue green yellow
black".  That is a *far* more substantive and disruptive change than
some of the colors coming out of alignment.  The very nature of the
gradient changes; white->yellow and white->blue are completely
different, as are blue->black and yellow->black.

> If it is important to keep all the
> items in order, then don't make them disappear, which is equally as bad as
> taking the out of order.

I would *highly* dispute that it's equally as bad.  If you lose some
colors you just lose a chunk of the image.  If the order swaps the
entire gradient can change, greatly disrupting its ability to blend
with surrounding content.

> Instead, insist on all values being of the same unit.

I think that's excessive and has no precedent in similar CSS.

> Otherwise, don't protect the author from himself, and just put the
> color stops where specified by the author. I don't have a problem with that.
> It's no worse than having multiple backgrounds, each with the
> background-position using different units.

Bad analogy.  Having your stops get pushed when necessary (due to
differing units behaving unpredictably in combination) is roughly akin
to having your background layers move due to them having their
position be defined in differing units.  Having your stops swap order
is much closer to having your background layers swap order.  I hope
you'd agree that that would be a *major* disruption to your design.

~TJ
Received on Monday, 17 August 2009 17:47:39 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:20 GMT