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

Colors #35

Closed
Fox32 opened this issue Aug 23, 2013 · 9 comments
Closed

Colors #35

Fox32 opened this issue Aug 23, 2013 · 9 comments

Comments

@Fox32
Copy link
Contributor

Fox32 commented Aug 23, 2013

Vector4 is designed to hold color values, too. What I'm missing are methods to convert colors to and from other formats like:

  • RGB(A)
  • Hex RGB String (like CSS color)
  • (HSV)

A colors class with definition of some known colors would be nice for fast prototyping, like:

colors.red => new Vector4(1.0, 0.0, 0.0, 1.0)
colors.green => new Vector4(0.0, 1.0, 0.0, 1.0)
...
colors.all => [colors.red, colors.green, ...] // Allows to choose a random color if needed

I could implement this. But the question is, is this more a vector_math or spectre related thing? Or is a own color class, like three.js has, the way to go?

@johnmccutchan
Copy link
Collaborator

Hi,

I think having an implementation in vector math makes sense.

@Fox32
Copy link
Contributor Author

Fox32 commented Sep 22, 2013

Seperate Color class vs Vector4?

Top level methods for conversation to the different formats?

@johnmccutchan
Copy link
Collaborator

Separate color class with (static?) methods for converting between different formats.

@Fox32
Copy link
Contributor Author

Fox32 commented Sep 22, 2013

Ok, I will look into this in the beginning of the next month.

@johnmccutchan
Copy link
Collaborator

Hi, any update on color class?

@Fox32
Copy link
Contributor Author

Fox32 commented Dec 20, 2013

I stopped because I'm not sure if a seperate color class is usefull.Some users may want a rgb, some a argb color. But both classes would manly be copies of Vector3 oder Vector4. If they are seperate classes interacting with methods that take a Vector4 as an argument may be difficult. I think we should add the color related functions to the Vector4 (and 3?) class instead.
For the list of named colors I opened issue #46 to allow creating read only colors.

@johnmccutchan
Copy link
Collaborator

Hi,

I think the color support should be implemented as classes with static methods:

class ColorConversion {
static void FromRGBAToHSV(Vector4 v, Vector3 o);
}

@johnmccutchan
Copy link
Collaborator

Ping.

@Fox32
Copy link
Contributor Author

Fox32 commented Feb 7, 2014

Ass a list what I would implement

  • fromRGBA
  • Parsing from hex color string with RGBA support
  • To hex color string
  • RGBA to HSV
  • HSV to RGBA
  • RGBA to HSL
  • HSL to RGBA
  • To grayscaled
  • Gamma/Linear conversation?
    All methods have a input and a ouput Vector4 as parameter
  • alphaBlend(Vector4 a, Vector4 b, Vector4 result)

Anything else? I will look into it later today or tomorrow.

@Fox32 Fox32 mentioned this issue Feb 8, 2014
@Fox32 Fox32 closed this as completed Feb 15, 2014
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

2 participants