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

color().alpha(1) is not returned in object() method. #120

Closed
juanpasolano opened this issue Jul 31, 2017 · 1 comment
Closed

color().alpha(1) is not returned in object() method. #120

juanpasolano opened this issue Jul 31, 2017 · 1 comment
Labels

Comments

@juanpasolano
Copy link

juanpasolano commented Jul 31, 2017

Hi there,
Why is it that object().alpha(1) does not return the alpha attr in the object() method?

color('#000000').alpha(0.5).object() returns {alpha: 0.5, b: 0, g: 0, r: 0}
but color('#000000').alpha(1).object() returns {b: 0, g: 0, r: 0} instead of {alpha: 1, b: 0, g: 0, r: 0}

Also wouldn't it make sense that color({r: 0, g: 0, b: 0, alpha: 1}).string() returns rgba(0,0,0,1) instead of rgb(0,0,0)

@Qix-
Copy link
Owner

Qix- commented Aug 1, 2017

Hi! rgb(0, 0, 0) and rgba(0, 0, 0, 1) are equivalent, so the library opts to return the shorter string.

As for the object notation, the library doesn't really treat alpha specially at all since none of the operations that are performed on colors have to do with the alpha channel.

It's a design decision, really. I think it's been like that since old versions, I can't remember.

@Qix- Qix- added the question label Aug 1, 2017
@Qix- Qix- closed this as completed Aug 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants