[whatwg] Canvas performance issue: setting colors

Vladimir Vukicevic vladimir at pobox.com
Mon Nov 10 00:05:30 PST 2008


On 10/3/08 4:37 PM, Oliver Hunt wrote:
> <thinking out loud>
> Just had a thought (no idea how original) -- how about if fillStyle were
> able to accept a 3 or 4 number array? eg. fillStyle = [0, 0.3, 0.6, 1.0] ?
>
> That might work well if people are using arrays as vectors/colours
> </thinking out loud>

I actually have a patch sitting around that starts to do this -- I never 
got around to proposing it to the list.  Parsing CSS-style color names 
is certainly flexible, but given that 99.9% of uses are going to be rgb 
or rgba, I'd agree that [r, g, b] or [r, g, b, a] should be accepted as 
colors (in the range of 0.0 to 1.0) wherever colors are accepted in the 
canvas API..

    - Vlad



More information about the whatwg mailing list