-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
programmatic equivalents of string constructors e.g. rgba #122
Comments
I'm not sure what you mean. The main constructor accepts strings: new Color('rgba(10, 150, 45, 0.2)') And What are you trying to achieve? |
hi, thanks, sorry for being unclear -- it confused me that Color.rgba() is not a function at all, but Color.rgb() is. Doing Color.rgb().alpha() is weird to my eyes. Dunno if that explains it any better. Basically if there's a constructor via strings, I'd expect there to be an equivalent pure-code non-string-parsing based version. I'm led to expect this since Color.rgb() exists, I think. |
The following should do what you're intending: new Color({r: 10, g: 150, b: 45, alpha: 0.2});
// or
new Color([10, 150, 45, 0.2], 'rgb'); I realize now that the makeover didn't include docs. Not sure why I did that. I do agree somewhat that the last optional value in the constructors should be an alpha value. I'll consider this for an enhancement. Thanks for bringing it up :) |
thanks, cool. |
Going to keep this open so I can modify the static constructors :) You're right in that they should accept alpha. |
The constructors accept alpha, so perhaps this is just an issue with docs - in which case, I'm going to close in favor of #181. Please correct me if I'm mistaken somehow. |
There's Color.rgb(255,255,255,0.5) which doesn't use strings, but I guess there's no Color.rgba()? Should there be non-string-parsing versions of things?
The text was updated successfully, but these errors were encountered: