dividat / elm-identicon / 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 -> Basics.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 -> Basics.Int

One-at-a-Time Hash

Taken from http://www.burtleburtle.net/bob/hash/doobs.html.

defaultColor : String -> Color

Generate a color from a string

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