jxxcarlson/elm-cell-grid/5.0.0

NOTE: the latest version is 8.0.1

CellGrid.Render

The CellGrid package provides a type for representing a rectangular grid of cells. CellGrids can be created, transformed, and rendered as either SVG or HTML.

type Msg
= MouseClick ( Int, Int ) ( Float, Float )

The MouseClick message sends the matrix index (i,j) of the cell on which the user has clicked as well as the local (x,y) coordinates of the cell.

renderAsHtml : Float -> Float -> CellRenderer a -> CellGrid a -> Html Msg

Render a cell grid as Html. The first two parameters are the width and height of the rendered grid in pixels.

renderAsSvg : CellRenderer a -> CellGrid a -> Svg Msg

Render a cell grid as SVG

type alias CellRenderer a =
{ cellSize : Float
, gridLineWidth : Float
, cellColorizer : a -> Color
, defaultColor : Color
, gridLineColor : Color
}

CellRenderer is a record that provides the information -- size and color -- that is needed to render a cell to SVG. Color is as defined in the package avh4/elm-color, e.g. Color.rgb 1 0 0, which is bright red.