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

Alpha component? #4

Open
jolleekin opened this issue Nov 24, 2014 · 5 comments
Open

Alpha component? #4

jolleekin opened this issue Nov 24, 2014 · 5 comments

Comments

@jolleekin
Copy link

Hi Michael,

Is there any plan to add the alpha component?

Thanks.

@jolleekin
Copy link
Author

Also, any plan for

  1. operations such as *, +, -, lerp (linear interpolation)
  2. inverted getter

@MichaelFenwick
Copy link
Owner

Alpha is planned, but far down the road. Still not sure if that should be new classes or an optional parameter on the existing classes.

Operators for +, -, and averaging are also planned. I have to add a few more color spaces first so that all of these operations make sense though.

I'm not sure what you mean by "inverted getter." Can you describe in more detail?

@jolleekin
Copy link
Author

The inverted of (r, g, b) is (255 - r, 255 - g, 255 - b).

I think new classes with the alpha component makes more sense as someone may be already using your package. In the future, you may deprecate classes without the alpha component.

In addition, since the package is mostly used in web applications, please consider

  • Adding a new method or modifying toString to return the HTML color string ('#123', 'rgb(0, 0, 0)', ...)
  • Adding a static parse method or a new constructor, which takes a string and returns a color, to each class
  • HexColor's default constructor should support '#ddd' and '#ddeeff' formats rather than 'ddeeff' format

@MichaelFenwick
Copy link
Owner

Well, a lot of this issue is still on the todo list, but I have added a toCssString() method to RGB, hex, and HSL color spaces, so you can use the Color package to generate css strings a little easier now.

@polotto
Copy link

polotto commented Aug 23, 2019

I got here when I tried generate a transparent color to my background. I din't find a way to generate a transparent CSS color patter using Color library.

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

No branches or pull requests

3 participants