Skip to content
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

Flag to return always the alpha value even if it's 1 #144

Open
lsunol opened this issue Oct 25, 2016 · 2 comments
Open

Flag to return always the alpha value even if it's 1 #144

lsunol opened this issue Oct 25, 2016 · 2 comments

Comments

@lsunol
Copy link

lsunol commented Oct 25, 2016

On the toRgbString method, I think it would be useful (at least for me) if there could be an option to get always the alpha value even if that is 1.
Now, if you call the toRgbString method of the red color you get:
> var a = tinycolor('red');
> a.toRgbString()
< rgb(255, 0, 0)
Would be great if I could do
> a.toRgbString(true)
< rgba(255, 0, 0, 1)
Many thanks

@aivarasbiliunas
Copy link

aivarasbiliunas commented Aug 2, 2018

If someone would still need it a quick and nice fix for this would be

const rgb = tinycolor('red'):
const withAlpha = `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${rgb.a})`;

CrandellWS added a commit to CrandellWS/TinyColor that referenced this issue Nov 4, 2018
@CrandellWS
Copy link

CrandellWS@4661a69

screenshot from 2018-11-04 06-02-04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants