Skip to main content

django-spectrum

Provides a colorpicker field for Django

image

PyPI Build Status

Compatibility

  • python >= 3.6
  • django >= 1.11

Quickstart

Install django-spectrum:

pip install django-spectrum

Add it to your INSTALLED_APPS list:

INSTALLED_APPS = (
    ...
    "spectrum",
)

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.red)
255

>>> print(c.alpha)
128

>>> print(c.hex)
#FFDA00

>>> print(c.hexa)
#FFDA0080

>>> print(c.rgb)
rgb(255, 218, 0)

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

>>> print(c.opacity)
0.5

>>> print(c.as_tuple())
(255, 218, 0, 128)

Metadata

Release files for django-spectrum 0.5.3

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-spectrum 0.5.3
File Size Uploaded
django-spectrum-0.5.3.tar.gz 122.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-spectrum 0.5.3
File Interpreter ABI Platform
django_spectrum-0.5.3-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 246.6 kB

Release files / django-spectrum-0.5.3.tar.gz

Download URL django-spectrum-0.5.3.tar.gz
Size 122.2 kB
Tags Source
SHA-256 checksum
How to use checksums
52fd2f3d7e89a84e6904914fdb76539fd401aa0ff1f934a4d64065835a0324e2
BLAKE2b-256 checksum
How to use checksums
951d7deeb5f2f106bc1b2008ba4ec1028f5338ffda1cd266572f46873644f75e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release files / django_spectrum-0.5.3-py2.py3-none-any.whl

Download URL django_spectrum-0.5.3-py2.py3-none-any.whl
Size 124.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
5ebb24295dbff26c7560fed64ea5ef359733ebb3d8d90b6da0b1ad30741b4ad4
BLAKE2b-256 checksum
How to use checksums
b552d9f999a39ee0010d1257e1bc1c8b1460560e4b2a7f9a3dc30402fb568987
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.5.3 This release

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

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