The current enum Color
type is copied from the days where Conrod used elmesque (a functional, elm-inspired rust graphics library). These days it really does not make sense for Color to be an enum.
I think we should change the Color
, Rgba
and Hsla
types to this:
pub struct Rgba(pub [f32; 4]);
pub struct Hsla(pub [f32; 4]);
pub type Color = Rgba;
If Rgba
is actually sRGB format, perhaps it's clearer if it's named Srgba
.
Edit: If not, the API docs should include that it's Linear
It seems like Rgba
and Hsla
structs are in the code. Is there anything else to be done?
Also, why have a type alias for Color
? Why not just force users to choose either Rgba
or Hsla
, since they are both already in the color
module in the first place?
Just an update of where I'm at on this - If I were to revisit this today, I'd likely remove hsl support, only provide a minimal Srgba
type and then refer users to the palette crate if they would like to work with other colour spaces.
Most helpful comment
If
Rgba
is actually sRGB format, perhaps it's clearer if it's namedSrgba
.Edit: If not, the API docs should include that it's Linear