Raphael: set the line color

I use the Raphael JS vector library and I cannot get the string (path) that I draw to change colors. Hope this is just something stupid.

var blue_one = paper.path ("M205 205L300 300");
blue_one.attr ("stroke-width", "3");
blue_one.attr ("fill", "#0000FF");

I also tried filling in the values ​​"# 00F", "blue", "0000FF" and "00F".

+5
source share
2 answers

This is what you want to install.

blue_one.attr ("stroke", "#0000FF");

For a complete list of properties, see the Raphael Specification or Documentation.

+16
source

It can be written simply on one line like this.

var blue_one = paper.path ("M205 205L300 300").attr({stroke:'#0000FF'});
0
source

All Articles