Closed chaitanyasunkara closed 2 years ago
This is definitely not a bug. The css colors are supported by modern browsers, but not natively supported in SVGjs. You can certainly write a plugin to add support for them if you'd like to but it shouldn't be included in the core.
For starters, you can't animate between the strings 'red' and 'green' in any reasonable way. We would need to maintain a mapping with all of those names in them. Instead you should use:
canvas.rect(100, 100).attr({ fill: 'rgb(255, 0, 0)' })
Or you can use our awesome color module to define your colours however you'd like. But internally, to be able to animate the string 'red', we'd need to convert it to an rgb tuple.
If you really want this functionality, you can just use this
https://stackoverflow.com/questions/1573053/javascript-function-to-convert-color-names-to-hex-codes
But I think that native support for these colors isn't something we'd add to the library
Bug report
Fiddle
this fiddle
Explanation