Is the `Color` module gone for good?

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 Ints in the 0…255 range to work with CSS? https://www.w3schools.com/cssref/css_colors_legal.asp

Ok, maybe I looked at the wrong definition. It does indeed look like the intended colorspace is a single one. In that case I don’t see how you can avoid multiple conversions if you have, say HSL and somebody else wants HSL but you go through the Color type.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.