Hello, I am in a database design dilemma.
In a web application I'm going to make, a table will be used to store colors. The stored colors will be in varying color systems (RGB, HSL, CMYK and LAB and/or HSV might be added later), so an enum field will be used to store the colorsystem. So, my question is, how to store the values?
Here is what I've thought so far about my options (feel free to add another if you think of something better!)
1. Just one int field that will store a combination of the values in some format and a colorsystem-particular formula will be used to extract the components.
Pros: Just one field for the value
Cons: We can't easily search for eg an RGB color with a Red value of 128, too complex
2. Four fields for the relevant components (only CMYK will need all four)
Pros: Easily searchable, very simple
Cons: Not elegant, doesn't feel right
3. All possible fields (Red, green, blue, hue, saturation, lightness, cyan, magenta, yellow, black)
Pros: We can store the color in any format, so that conversions won't be needed to be performed on runtime, easily searchable, fairly obvious
Cons: Too verbose, not good for maintenance (What happens when lots more colorsystems are added?)
This has been troubling me for days, and I can't start to work on the site unless I figure it out. Any ideas?