Generate letter avatar from username.
Shamelessly copied from alchemic_avatar and slightly modified with this code sample originally written by Sergio Tapia
If available in Hex, the package can be installed
by adding abatap
to your list of dependencies in mix.exs
:
def deps do
[
{:abatap, "~> 0.2.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/abatap.
## default options
# - palette: :google
# - shape: :square
# - size: 512
# - padding: size * 0.546875
iex> Abatap.create_from_initials("John", "Doe")
{:ok, "/var/folders/bq/v60646nd7370n3lffmgfh94r00016k/T/JD-google-1731556906832.png"}
iex> Abatap.create_from_initials("John", "Doe", palette: :google)
{:ok, "/var/folders/bq/v60646nd7370n3lffmgfh94r00016k/T/JD-google-1731556436238.png"}
iex> Abatap.create_from_initials("John", "Doe", palette: :iwanthue, shape: :circle)
{:ok, "/var/folders/bq/v60646nd7370n3lffmgfh94r00016k/T/JD-iwanthue-1731557222647.png"}
iex> Abatap.create_from_initials("John", "Doe", palette: :google, shape: :squircle, size: 1024, padding: 400)
{:ok, "/var/folders/bq/v60646nd7370n3lffmgfh94r00016k/T/JD-google-1731556436238.png"}
A palette generated from: