An Elm library to help you implement a color picker tool.
Opaque type. These messages are handled by ColorPicker.update
Initial ColorPicker state
init =
{ myColour = Color.red
, colorPicker = ColorPicker.empty
}On each update, ColorPicker returns its model and (where appropriate) the new selected colo(u)r.
ColorPickerMsg msg ->
let
(cp, col) =
ColorPicker.update msg model.colorPicker
in
{ model | colorPicker = cp, myColor = Maybe.withDefault model.myColor col }The main picker is for saturation and lightness, while the sliders below are for hue and opacity respectively.
Opaque type. Needs to be added to your model. You will also need to store a
Colorin your model