Add support for transparent value in fabric.Color

This commit is contained in:
kangax 2014-05-09 22:43:47 +02:00
parent 916b35b93d
commit 87b0f2da35
2 changed files with 9 additions and 0 deletions

View file

@ -43,6 +43,11 @@
color = Color.colorNameMap[color];
}
if (color === 'transparent') {
this.setSource([255,255,255,0]);
return;
}
source = Color.sourceFromHex(color);
if (!source) {

View file

@ -324,4 +324,8 @@
oColor.overlayWith(new fabric.Color('rgb(0,0,0)'));
equal(oColor.toRgb(), 'rgb(128,128,128)');
});
test('transparent', function() {
deepEqual(new fabric.Color('transparent').getSource(), [255,255,255,0]);
});
})();