View Source Avatador (avatador v0.1.0)
Avatador
Link to this section Summary
Link to this section Functions
Create an avatar from a Map of options.
Returns a ~s() SVG.
examples
Examples
# An avatar with background of "#962ED" and name "John Doe"
iex> Avatador.avatar(%{background: "96C2ED", name: "John Doe"})
# An avatar with a random background, name "John Doe", and width of "50px"
iex> Avatador.avatar(%{name: "John Doe", width: "50"})
arguments
Arguments
:backgroundThe background color of the avatar, without the hash (#) e.g.000000.:colorThe text color of the avatar, without the hash (#) e.g.FFFFFF.:nameThe name/username/email of the entity you want the avatar's initials to represent.:is_roundedTrue or false, should avater be rounded? Iftrueand noroundedvalue it assumes the width/height (fully rounded).:roundedThe px value of rounding, leave blank or0for no rounding.:widthThe height of the avatar in pixels. If not provided assumes width=height or default value.:heightThe width of the avatar in pixels. If not provided assumes width=height or default value.:font_sizeThe font size in pixels.:font_familyThe name of the font family.:capsCapitalization of the initials. 1 for uppercase, 2 for lowercase, 3 for leaving as provided.:boldTrue or false, should text be bold?
defaults
Defaults
%{
background: "#000000",
color: "#FFFFFF",
name: "",
is_rounded: false,
rounded: 0.0,
width: 500.0,
height: 500.0,
font_size: 250.0,
font_family: "Montserrat",
caps: 1,
bold: true,
}
Create an identicon from a Map of options.
Returns a ~s() for SVG or a base64 encoded PNG.
examples
Examples
# An identicon with background of "#962ED" and name "John Doe"
iex> Avatador.identicon(%{background: "96C2ED", name: "John Doe"})
# An identicon in PNG with a random background, name "John Doe", and width of "50px"
iex> Avatador.identicon(%{format: "PNG", background: "96C2ED", name: "John Doe", width: "50"})
arguments
Arguments
:formatSVG or PNG output.:backgroundThe background color of the avatar, without the hash (#) e.g.000000.:colorThe text color of the avatar, without the hash (#) e.g.FFFFFF.:nameThe name/username/email of the entity you want the avatar's initials to represent.:is_roundedTrue or false, should avater be rounded? Iftrueand noroundedvalue it assumes the width/height (fully rounded).:roundedThe px value of rounding, leave blank or0for no rounding.:widthThe height of the avatar in pixels. If not provided assumes width=height or default value.:heightThe width of the avatar in pixels. If not provided assumes width=height or default value.
defaults
Defaults
%{
format: "SVG",
background: "#000000",
color: "#FFFFFF",
name: "",
is_rounded: false,
rounded: 0.0,
width: 500.0,
height: 500.0,
}