Re: Gradient syntax proposal

On Fri, Aug 14, 2009 at 4:07 PM, fantasai<fantasai.lists@inkedblade.net> wrote:
> Tab Atkins Jr. wrote:
>>
>> On Fri, Aug 14, 2009 at 3:47 PM, fantasai<fantasai.lists@inkedblade.net>
>> wrote:
>>>
>>> Brad Kemper wrote:
>>>>
>>>> One of the things I really hate about using "<bg-position>,
>>>> <bg-position>"
>>>> is that comma to separate the two lengths or keywords on the left from
>>>> those
>>>> on the right. Since commas are already being used to separate
>>>> color-stops,
>>>> this just makes the whole thing harder to read, because they are no
>>>> longer
>>>> used consistently to group like things. When they are used only for
>>>> color-stops, then you can see in a glance how many color-stops there are
>>>> instead of having to study it more closely with a line full of distances
>>>> and
>>>> commas. For instance, I find the following very hard to read, and it
>>>> probably doesn't even make sense (which is another problem with this
>>>> kind of
>>>> construction).
>>>> |linear-gradient(10px 30%, 100% 4%, 50% green, 20% blue)|
>>>
>>> I completely agree. How about using a keyword?
>>>
>>>  linear-gradient(10px 30% to 100% 4%, green, blue 20%, navy);
>>>
>>> For simpler cases you'd get
>>>
>>>  linear-gradient(left to right, green, blue, navy);
>>
>> I like the "to" keyword for the <bg-position> construction!  It
>> expresses the relationship very nicely.  Using it on the simpler
>> construction is nice and literate, but sort of unnecessary; I think
>> "linear-gradient(left, green, blue, navy)" is pretty clear?
>
> Yes, I think it makes sense to allow that as a shortened version.

Hmm, so if we allowed the literate version of the second construction,
we'd presumably allow all 8 of the side/corner keywords, with the
clarification that "left" actually means "left center", etc so you
could actually do stuff like "left to top" and have it be meaningful
(the gradient-line would start at the center of the left side, and end
at the center of the top side) or even "left to top-right".

At the very least, that would clear up the definitions of the
left/right/top/bottom keywords, which are specified sort of wonky
right now.

I've made the change to my draft.  Literate versions of the second
construction are allowed; if the second bit is omitted it defaults to
the opposite side/corner.  The side keywords refer to the center of
the specified side.

~TJ

Received on Friday, 14 August 2009 21:31:35 UTC