View Source README

Avatador
Super simple avatar generator in Elixir.
options
Options
:formatSVG or PNG. PNG is only supported with identicons.:backgroundThe background color hex of the avatar, without the hash (#) e.g.000000.:colorThe text color hex 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
%{
format: "SVG"
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,
}
supports
Supports
- Simple simple cache:
:nameis hashed so that the same:namewill receive the same:backgroundcolor. - Alpha colors: Supported color formats include #rgb, #rgba, #rrggbbaa, and #rrggbbaa.
- Can create avatars and GitHub-like identicons.
installation
Installation
The package can be installed by adding avatador to your list of dependencies in mix.exs.
If you want PNG support for the identicons, you will also need to add :egd.
def deps do
[
{:avatador, "~> 0.1.0"},
{:egd, github: "erlang/egd", optional: true}, # Erlang Graphic Drawer, for PNG export of identicons
]
end
acknowledgements-and-credits
Acknowledgements and Credits
- The identicons code is based on identicon.
- Color helper code is based on color_utils.
development
Development
- Questions, tips, code fixes, overhauls, and other contributions are very much welcome! Please submit an issue or a pull request.
- Run tests with
mix test - Create docs with
mix docs