Handle color parsing when alpha = 1 (#512)

The `color` library doesn't include alpha when accessing `color.rgb().array()` when the alpha value is 1. Since we always use the alpha value, make it default to 1 when parsing a color.
This commit is contained in:
James Ide
2017-11-23 13:47:01 -08:00
committed by Dustin Savery
parent ffea98f863
commit f9e774e03d
2 changed files with 7 additions and 7 deletions
+5 -5
View File
@@ -36,11 +36,11 @@ export default function(props) {
const gradient = [];
sorted.forEach(({stop}) => {
let channels = stop.rgbaArray();
gradient.push(channels[0] / 255);
gradient.push(channels[1] / 255);
gradient.push(channels[2] / 255);
gradient.push(channels[3]);
let [r, g, b, a = 1] = stop.rgb().array();
gradient.push(r / 255);
gradient.push(g / 255);
gradient.push(b / 255);
gradient.push(a);
});
gradient.push(...sorted.map(({offset}) => +offset));