Add option for opacity/alpha
SlowMo24 opened this issue · comments
Moritz Schott commented
I would like to have rgba
-values as output. I cannot find that option so I guess this would need an extension to the existing color-getter-functions to accept an optional alpha-value?
Curran Kelleher commented
You could convert colors to RGBA format using d3.rgb
.
const { r, g, b, opacity } = d3.rgb(color);
const formatted = `rgba(${r},${g},${b},${opacity})`;
Moritz Schott commented
ah nice, thank you! I didn't know about that function (and solved it with string replacement, but this is nicer).