Skip to content

Commit 22eacec

Browse files
committed
Update color-rgba use
1 parent a683731 commit 22eacec

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/lib/gl_format_color.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ function calculateColor(colorIn, opacityIn) {
2525
}
2626

2727
function validateColor(colorIn) {
28-
return isNumeric(colorIn) ? colorDfltRgba : (rgba(colorIn) || colorDfltRgba);
28+
if (isNumeric(colorIn)) return colorDfltRgba;
29+
30+
var colorOut = rgba(colorIn);
31+
32+
return colorOut.length ? colorOut : colorDfltRgba;
2933
}
3034

3135
function validateOpacity(opacityIn) {

src/lib/str2rgbarray.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
var rgba = require('color-rgba');
1313

1414
function str2RgbaArray(color) {
15-
return rgba(color) || [0, 0, 0, 1];
15+
var colorOut = rgba(color);
16+
return colorOut.length ? colorOut : [0, 0, 0, 1];
1617
}
1718

1819
module.exports = str2RgbaArray;

0 commit comments

Comments
 (0)