shamansir / elm-canvas / Canvas.Settings


type alias Setting =
Canvas.Internal.Canvas.Setting

Similar to Html.Attribute, settings control the presentation and other style options for the Renderables.

Styling the things you draw

The two main style settings are fill color and stroke color, which are documented here.

fill : Color -> Setting

By default, renderables are drawn with black color. If you want to specify a different color to draw, use this Setting on your renderable.

The type Color comes from the package avh4/elm-color. To use it explicitly, run:

-- elm install avh4/elm-color

and then import it in.

import Color
-- ...
shapes
    [ fill Color.green ]
    [ rect ( 10, 30 ) 50 50 ]

stroke : Color -> Setting

By default, renderables are drawn with no visible stroke. If you want to specify a stroke color to draw an outline over your renderable, use this Setting on it.

The type Color comes from the package avh4/elm-color. To use it explicitly, run:

-- elm install avh4/elm-color

and then import it in.

import Color
-- ...
shapes
    [ stroke Color.red ]
    [ rect ( 10, 30 ) 50 50 ]

If you want to modify the appearance of the stroke line, you can use other Settings from the Canvas.Settings.Line module.

Other frequently used settings

There are other style settings in the documentation (if you search for things that return a Setting you can see). More specifically: