I don’t see how it is too complicated? There is a single colour space with just enough functions hanging off it to cover the possible ways of describing colours in CSS.
More advanced colour models can easily be built on top of this, and can convert through it. That said, assuming it will only ever have a single colour space representation in this module, no harm in exposing it as a record type alias.
toRgba : Color -> { red : Float, green : Float, blue : Float, alpha : Float }
I presume the colour values here are in the range 0…1? Do you also need some conversion functions that output Int
s in the 0…255 range to work with CSS? https://www.w3schools.com/cssref/css_colors_legal.asp