Skip to main content

Provides a colorpicker field for Django

Project description


Provides a colorpicker field for Django


PyPI Build Status


  • python >= 3.6
  • django >= 1.11


Install django-spectrum:

pip install django-spectrum

Add it to your INSTALLED_APPS list:


Then add it to your models:

from django.db import models
from spectrum.fields import ColorField

class MyModel(models.Model):
    color = ColorField(_("color"), default="#FFFF00")

Color class

The module defines a Color class which is used to represent the ColorField attribute on the model. The Color class can also be used standalone without any Django model.

Some examples of funcionality provided by the Color class:

from spectrum.color import Color

c = Color("#FFDA0080")

>>> print(c.opaque)

>>> print(c.hex())

>>> print(c.hexa())

>>> print(c.rgba())
"rgba(255, 218, 0, 0.5)"

>>> print(c.opacity())

>>> print(c.hsla())
"hsla(51, 100.0%, 50.0%, 0.5)"

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-spectrum, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size django_spectrum-0.3.0-py2.py3-none-any.whl (43.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size django-spectrum-0.3.0.tar.gz (33.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page