dividat/elm-identicon/1.0.0

Identicon

Generate an identicon from a string.

Creating

identicon : String -> String -> Html msg

Generate a identicon from a string

main =
    identicon "200px" "Hello identicon!"
custom : (String -> Int) -> (String -> Color) -> String -> String -> Html msg

Creates an identicon with your own hasher/colorer where the string is passed into both the hasher and colorer. Here's how to create an identicon that's always the color red:

import Color exposing (rgb255) -- from avh4/elm-color
import Identicon exposing (custom, defaultHash)
import Html exposing (Html)


view : Html msg
view =
    custom defaultHash (always <| rgb255 255 0 0) "200px" "Hello Identicon!"

Defaults

defaultHash : String -> Int
defaultColor : String -> Color

Generate a color from a string

This generates the same color that would be used in the identicon.