A ridiculously simple avatar generator with initials from names.
Project description
django-initials-avatar
Summary | A ridiculously simple avatar generator with initials from names. |
---|---|
Original Repository: | eddiejibson/avatars |
Installing
First add the application to your Python path. The easiest way is to use pip:
pip install django-initials-avatar
Check the Release History tab on the PyPI package page for pre-release versions. These can be downloaded by specifying the version.
You can also install by downloading the source and running:
python setup.py install
Configuring
Make sure you have add the django_initials_avatar application to your INSTALLED_APPS list:
INSTALLED_APPS = (
...
'django_initials_avatar',
)
Then ensure that your project URL conf is updated.
from django.urls import path, include
urlpatterns = [
...
path("initials-avatar/", include('django_initials_avatar.urls'))
]
Default Background Colors
INITIALS_AVATAR_BG_COLORS = [
"#E284B3", "#FFED8B", "#681313", "#F3C1C6", "#735372", "#009975", "#FFBD39", "#B1E8ED", "#52437B", "#F76262",
"#216583", "#293462", "#DD9D52", "#936B93", "#6DD38D", "#888888", "#6F8190", "#BCA0F0", "#AAF4DD", "#96C2ED",
"#3593CE", "#5EE2CD", "#96366E", "#E38080"
]
Default Text Color
INITIALS_AVATAR_TEXT_COLOR = '#fff'
Default Text Length
INITIALS_AVATAR_TEXT_LENGTH = 2
Default Avatar Width
INITIALS_AVATAR_WIDTH = 500
Default Avatar Height
INITIALS_AVATAR_HEIGHT = 500
Default Avatar Font Size
INITIALS_AVATAR_FONT_SIZE = 250
Avatar Rounded By Default
INITIALS_AVATAR_ROUNDED = False
Avatar Capitalize by Default
INITIALS_AVATAR_CAPITALIZE = False
Avatar Lowercase by Default
INITIALS_AVATAR_LOWERCASE = False
Avatar Bold by Default
INITIALS_AVATAR_BOLD = False
Cache timeout
INITIALS_AVATAR_CACHE_TIMEOUT = 60 * 60
Usage Overview
In most cases it will probably be more efficient to use the template tag to get the avatar's reverse url
{% load initials_avatar %}
{% render_initials_avatar "Your Name Here" %}
You can also pass parameters
{% load initials_avatar %}
{% render_initials_avatar "Your Name Here" background="transparent" %}
Available parameters:
- name
- background
- color
- length
- width
- height
- size
- rounded
- capitalize
- lowercase
- bold
Baseado em: https://github.com/eddiejibson/avatars
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_initials_avatar-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3bcd2879d68fbf92d3d8914bd2a909bf96798ec5d659e68d801d81e28444406e |
|
MD5 | a2ac2e1219acbe15c54d156ec7e03562 |
|
BLAKE2b-256 | 98d8bed560f30cd85f57f6b36642bd98356bfc563793d4a010493856dfb2cffd |
Hashes for django_initials_avatar-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4158dd0fe3cc41e7d40e3c841e1c7ef70108c3c7edbb9fd01a8bad148f47d38f |
|
MD5 | 1db81595ecc31d94a48785127c82c57f |
|
BLAKE2b-256 | 20d1f51f9fee3c00716871d19403985c1aecf42ea2840471ace112c09fc95011 |