fix rgba fill and stroke bug

This commit is contained in:
Horcrux
2016-06-10 23:33:18 +08:00
parent dba1fb2801
commit 239e1c928d
4 changed files with 14 additions and 13 deletions
+7 -2
View File
@@ -1,9 +1,14 @@
import Color from 'color';
let noneFill = ['transparent', 'none'];
export default function (color, opacity = 1) {
export default function (color, opacity) {
if (noneFill.indexOf(color) !== -1 || !color) {
return Color('#000');
} else {
return Color(color).alpha(+opacity);
let c = Color(color);
if (!isNaN(opacity)) {
c = c.alpha(opacity);
}
return c;
}
}