Skip to main content

django-initials-avatar

Summary A ridiculously simple avatar generator with initials from names.
Original Repository eddiejibson/avatars
Django Packages packages/django-initials-avatar

Upload Python Package Python package CodeQL

"Buy Me A Coffee"

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

Desired next step

Make it possible to render the png instead of an svg, perhaps directly converting the svg to png. However so far the libraries need specific dll's and the intention would be to avoid this type of need.

Metadata

Release files for django-initials-avatar 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-initials-avatar 0.0.7
File Size Uploaded Provenance
django_initials_avatar-0.0.7.tar.gz 11.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-initials-avatar 0.0.7
File Interpreter ABI Platform
django_initials_avatar-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 23.9 kB

Release files / django_initials_avatar-0.0.7.tar.gz

Download URL django_initials_avatar-0.0.7.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
108c1865d366ce5c8ade0e75723469abab74c35aaf2a3867802c772e68ec63aa
BLAKE2b-256 checksum
How to use checksums
f3183c6c738806b478d96fc574e2060294440b74e2c84d5479b3931e6dd68192
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / django_initials_avatar-0.0.7-py3-none-any.whl

Download URL django_initials_avatar-0.0.7-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e9dfc32bf2d6a24b982474641406386e6a98086a5be862fce46afca58f8d9cd9
BLAKE2b-256 checksum
How to use checksums
95fc70dea3600c1da431020d69635da2ee14fa2150c88e9f2b53c87c0ca8c3a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Security for django-initials-avatar 0.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page