Open kuon opened 6 years ago
Yes, I just got a surprise when I was about to List.map
an elm-color palette to a function that creates elm-ui elements and the Color types didn't match. I guess I'll use typed-svg instead for this particular example, but it would be nice to be able to do it in the future.
How would such a constructor look? Is it something that is easy to do and be used ad-hoc in the meantime?
A temporary workaround for those who want to convert avh4/elm-color to elm-ui color:
toElmUiColor : Color.Color -> Element.Color
toElmUiColor color =
Element.fromRgb <| Color.toRgba color
To convert from elm-ui color to avh4/elm-color:
toElmColor : Element.Color -> Color.Color
toElmColor color =
Color.fromRgba <| Element.toRgb color
It would be great if elm-ui used elm-color
indeed. I'm trying to use it in an app that also uses elm-collage
, which has a peer depedency for elm-color
.
To help with consistency, we created a new color package.
https://package.elm-lang.org/packages/avh4/elm-color/latest/Color
Elm-UI is a good candidate to use that new package.
There are two solutions:
Color
type and the remove customColor
type fromelm-ui
.elm-ui
ownColor
type and create constructors that accept the newColor
type.I know 2. is needed to help
elm-ui
optimize (by keeping css string maybe) but I think the drawback of having multiple color type is too high and that 1. should be preferred.