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 }Renders the color picker on screen
Converts Color to String (with preceding #).
Used internally and exposed because the public alternative is a library with multiple dependencies.
Converts String to Color.
Used internally and exposed because the public alternative is a library with multiple dependencies.
Opaque type. Needs to be added to your model. You will also need to store a color in your model