A python API wrapper for DiceBear's avatar generating API.
Project description
DiceBear Py Wrapper
dicebear
is an API wrapper for https://dicebear.com. Using this wrapper you can get custom avatars for your program.
For an example go to examples/dicebear.py
.
Useful links
How to install
Run pip install dicebear
If that doesn't work try py -m pip install dicebear
Usage
from dicebear import DAvatar, DStyle, DOptions, DColor
options = DOptions(backgroundColor=DColor("#00ddd0"))
av = DAvatar(style=DStyle.pixel_art, seed="John Apple", options=options)
# this returns a URL to the avatar
print(av)
# str(DAvatar) returns the png url to the avatar
print(av.style, av.seed, av.options)
av.edit(extra_options=DOptions(flip=True))
# edit the avatar more to your liking
# using `extra_options` you add/replace these options to the old ones
# using `blank_options` you reset the old options and add these new options
print(av.url_png, av.url_svg)
print(av.full_svg)
# using `DAvatar.avatar_svg` you can get the svg code for the avatar
Styles
All the possible avatar styles.
https://avatars.dicebear.com/styles
adventurer
adventurer-neutral
avataaars
big-ears
big-ears-neutral
big-smile
bottts
croodles
croodles-neutral
identicon
initials
micah
miniavs
open-peeps
personas
pixel-art
pixel-art-neutral
Base Options
All the possible options for the avatar. These options work for all the styles.
seed
(type:str
) - the seed for the avatar generator (determine its basic looks)dataUri
(type:bool
) - whether to give the dataUriflip
(type:bool
) - flips the image verticallyrotate
(type:int
) - rotates the avatarscale
(type:int
) - the scale of the avatarradius
(type:int
) - the radius of the avatarsize
(type:int
) - the size of the avatarbackgroundColor
(type:DColor( " #ffffff " )
) - the background color of the avatartranslateX
(type:int
) - move the avatar horizontallytranslateY
(type:int
) - move the avatar vertically
Specific Style Options
Specific options to get a more detailed avatar. This is different for every style.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dicebear-0.2.6.tar.gz
(6.6 kB
view hashes)
Built Distribution
dicebear-0.2.6-py3-none-any.whl
(15.3 kB
view hashes)