You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var color = Spectra("rgba(255, 0, 0, 0.5)");
ctx.fillStyle = color;
console.log(Spectra(ctx.fillStyle).rgbaString()); // rgba(255,0,0,1)
I would expect the last statement to print "rgba(255,0,0,0.5)".
By far the easiest fix would be to let .toString() equal .rgbaString(). A slightly more sophisticated fix would be to let .toString equal the input type:
@avp The version was not the problem. It's important that you use an actual ctx, since assigning a Spectra color to the ctx calls .toString on that object because it expects a string, doing the same but with a plain object doesn't call toString, since nesting objects is perfectly valid.
See the following two examples, that illustrate the problem even on the currently most recent Spectra v0.2.4. The transparency of the color is definitely lost in interpretation, which is not nice :(
I would expect the last statement to print "rgba(255,0,0,0.5)".
By far the easiest fix would be to let .toString() equal .rgbaString(). A slightly more sophisticated fix would be to let .toString equal the input type:
The text was updated successfully, but these errors were encountered: