Models
Classes used to facilitate the module's usage.
Variables
options
(list): all possible basic options (work for all styles)default_options
(dict): a dict with all default optionsstyles
(list): all available styles
class DColor
def __init__()
All colors used for this module are made with this class. This uses HTML/hex color codes.
Note that html_code
can also be transparent
when used for the backgroundColor
option!
Returns:
None
: when called as string it will return the color codeRaises:
IncorrectColor
: an incorrect html color code is given
Parameter | Type | Default | Description |
---|---|---|---|
|
| HTML/hex color code. This can be a list of strings if |
def random()
Get a random valid HTML color code.
class DStyle
def __init__()
Not to be initialized!
def get_schema()
Returns a dict with the JSON schema (all properties) of the given avatar style.
Returns:
dict
: the dictionary containing the avatar style's schema.
Parameter | Type | Default | Description |
---|---|---|---|
| N/A | The name of the style you want to get the schema of. |
def random()
Get a random style for DStyle
.
Returns:
str
: returns a random Style string.
def from_str()
Get an avatar style from a string.
Returns:
str
: returns a Style string from the given string if the style exists.
Parameter | Type | Default | Description |
---|---|---|---|
| N/A | The string to form a style. |
Attributes
For more info check Styles.
list
=all_styles
adventurer
adventurer_neutral
avataaars
avataaars_neutral
big_ears
big_ears_neutral
big_smile
bottts
bottts_neutral
croodles
croodles_neutral
dylan
fun_emoji
glass
icons
identicon
initials
lorelei
lorelei_neutral
micah
miniavs
notionists
notionists_neutral
open_peeps
personas
pixel_art
pixel_art_neutral
rings
shapes
thumbs
class DFormat
def __init__()
Not to be initiated!
def from_str()
Returns:
str
: returns a Format string from the given string if the format exists.
Parameter | Type | Default | Description |
---|---|---|---|
| N/A | The string to form a format. |
Attributes
list
=all_formats
svg
webp
avif
png
jpg
jpeg
json
class DOptions
def __init__()
Returns:
DOptions
: theDOptions
instance to use forDAvatar
.
Parameter | Type | Default | Description |
---|---|---|---|
|
| Whether to flip the image vertically | |
| default min | Rotate the avatar | |
| default | Scale of the drawn avatar | |
| default | Radius of the avatar (borders) | |
| default | Size of the avatar (in pixels) | |
|
| Background color for the avatar image | |
|
| The type of background (only | |
|
| The background's rotation (only with | |
| default | Move the avatar horizontally | |
| default | Move the avatar vertically | |
| default | Randomize the IDs in the generated SVG/XML, can be useful if the avatars are included directly in HTML and you want to avoid ID conflicts. | |
| Any | N/A | Kwargs |
Attributes
empty
default_options
=default
Last updated