[whatwg] Request: Canvas Tag CSS
ian at hixie.ch
Thu Apr 30 14:12:43 PDT 2009
On Sun, 6 Apr 2008, Greg Houston wrote:
> Having worked with the canvas tag quite a bit now, I've found that it is
> a bit awkward that the canvas tag is not taking advantage of CSS. If you
> are changing your site design, perhaps you want to change the colors
> used in your line graphs as well. So you make the changes in your CSS
> for the majority of your elements, which is rather painless, and then
> to make your changes.
For simple things, e.g. colours or fonts, you can use getComputedStyle()
on the <canvas> itself to get styles from the CSS, and use those in the JS
instead of hardcoding the values. But this doesn't work as a general
solution for multiple colours, gradients, etc.
It's not clear to me how to solve this problem in general, e.g. for things
like gradients and patterns, where CSS doesn't really match the way canvas
works. Short of inventing a bunch of new syntax, I don't know what to do.
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the whatwg