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 22:15:56 -0500
Message-ID: <dd0fbad0908172015u745ba7dbo1c9af414861dea2@mail.gmail.com>
To: fantasai <fantasai.lists@inkedblade.net>
Cc: www-style@w3.org
On Mon, Aug 17, 2009 at 8:58 PM, Tab Atkins Jr.<jackalmage@gmail.com> wrote:
> On Mon, Aug 17, 2009 at 5:34 PM, fantasai<fantasai.lists@inkedblade.net> wrote:
>> Tab Atkins Jr. wrote:
>>>
>>> On Mon, Aug 17, 2009 at 3:54 PM, fantasai<fantasai.lists@inkedblade.net>
>>> wrote:
>>>>
>>>> Brad Kemper wrote:
>>>>>
>>>>> On Aug 17, 2009, at 11:00 AM, fantasai <fantasai.lists@inkedblade.net>
>>>>> wrote:
>>>>>
>>>>>> I would prefer restricting stops to percentages. The swapping effect
>>>>>> is confusing, and I don't see any reason you'd /need/ to use lengths
>>>>>> when you can specify the length of the overall gradient already.
>>>>>
>>>>> I can think of plenty of situations where  I'd want the whole gradient
>>>>> to
>>>>> be a fixed distance, regardless of box size, and regardless of angle.
>>>>> I'd
>>>>> like to be able to set that in a simple grammar, using color-stops only.
>>>>> It's not nearly as simple if the angle is not a multiple of 90, and I
>>>>> have
>>>>> to use bg-position.
>>>>
>>>> This is not simple?
>>>>
>>>>  linear-gradient(top left 135deg 200px / red, white, blue)
>>>>  /* linear gradient from top left corner angled at 135deg going for 200px
>>>>    transitioning from red to white to blue */
>>>
>>> That requires an *additional* argument to the angle construction.
>>> It's equally easy to do:
>>>
>>> linear-gradient(135deg / red, white, blue 200px)
>>
>> Which requires an additional argument to the last color construction. :)
>
> Ah, but it's an argument that's already included in the syntax.
>
>> Is the 200px offset from the beginning of the gradient or from the
>> last color stop? I'm not totally clear on this. (I find it easier
>> to think of the entire gradient being 200px long and then filling
>> in the color stops than positioning the last color stop and then
>> filling in the color stops backwards from there.)
>
> All color-stop lengths and % measure from the beginning.
>
>>> (You probably meant an angle other than 135deg, btw.  That points up
>>> into the top-left, and would currently result in a pure-blue gradient
>>> as the starting and ending points are identical.)
>>
>> Heh, okay. I wasn't sure which direction 0deg was pointing.
>> For several other properties (e.g. image-orientation) it's up.
>
> Well, not really.  The angle in image-orientation describes a
> rotation, not a direction.  It just reuses SVG's definition of
> positive angles meaning a CW rotation, which is a little confusing.
> But doing *anything* other than 0deg=East, 90deg=North for actual
> directional angles would be extremely confusing as well.
>
> I'll make it explicit.
>
> ~TJ
>

I've made the proposal explicit about how the angle works, rather than
forcing everyone to infer it from the default starting corner.

I've also gone ahead and changed the color-stop description to require
that they be specified in order, and that out-of-order stops just sit
on top of each other.

Also, if you haven't seen it in a while, I've upgraded the CSS on my
document viewer (from "none" to "some"), so it's actually halfway
pleasant to read now.

http://www.xanthir.com/document/document.php?id=d65df9d10442ef96c2dfe5e1d7bbebf7aa42f2bcf24e68fc3777c4b484fa8a4ce55fed2189cac20ccad8686127f4c08917c4ca8b7614e9f89c2a950ec083a9c6
Received on Tuesday, 18 August 2009 03:16:58 GMT

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