Re: [css3-images] Making gradients readable

On Tue, Nov 1, 2011 at 3:33 PM, L. David Baron <dbaron@dbaron.org> wrote:
> The thing I don't like is that, in general, I don't like something
> that looks like this:
>
>  function(foo bar as a, b, c)
>
> because I think when you have commas inside of functions, it's
> natural to split it like this (because many languages separate
> things inside functional syntax with commas):
>
>   foo bar as a
>   b
>   c
>
> rather than splitting it as:
>   foo bar
>   a, b, c
>
> I thus prefer replacing the "as" with a ",".

I agree.  It also seems slightly more in tune with normal CSS syntax,
where the comma is a higher-level grouper than the space.  Finally, it
means we don't have to change that part of linear-gradient() to be
consistent, which is a plus.


> Second, I think the <shape-info> really has two parts -- there's a
> shape and a size (or extents).  I wonder if this could be recast as:
>
>  radial-gradient( <shape>?
>                   from <position>
>                   to <extents>
>                   [, <color-stop>] + )

I like this a *lot* (if you replace 'from' with 'at') - it's
definitely my favorite so far.  Not only does it read better, the 'to'
is consistent with linear-gradient().

More precisely, I think the grammar would be:

radial-gradient(
  <shape>?
  [
    [ at<position> ]?
    ||
    [ to <extents> ]?
  ]
  , <color-stop># );

(I'm not going to try and express the grammar properly for the one
comma there - it's impossible without being ridiculously verbose.)

~TJ

Received on Thursday, 3 November 2011 09:25:56 UTC