[css-images] gradient midpoints

At the CSS F2F in Seattle, we decided to use exponential interpolation
function to calculate the color ramps when there is a gradient midpoint. [1]

Right now the spec [2] states:

Similarly, the color of a color stop can be omitted. The causes the color
to be automatically computed to halfway between the two surrounding stops,
so that the "midpoint" of a transition can be easily adjusted.

which specifies linear interpolation that results in banding.
Could we add the right formula here?
To calculate a color C between:

   - C0 = color stop on the left
   - C1 = color stop on the right
   - N = value between 0 and 1 describing the distance of the midpoint
   between C0 and C1
   - X = value between 0 and 1 describing the distance of the C between C0
   and C1

The formula is: C = C0 + pow(x, log(.5)/log(X)) * (C1 - C0)

The spec also has this wording:

If multiple stops in a row lack a color, they space themselves out equally
in "color space", giving more control over the smoothness of the transition.

Is this to add multiple midpoints?

1: http://lists.w3.org/Archives/Public/www-style/2014Feb/0609.html
2: http://dev.w3.org/csswg/css-images-4/#color-stop-syntax

Received on Thursday, 17 April 2014 17:58:47 UTC