Skip to main content

Provides an colorpicker field for use in Django models

Project description

django-spectrum

Provides an colorpicker field for use in Django models.

django-spectrum

Compatibility

  • django >= 2.0
  • python >= 3.4

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 spectrum.fields import ColorField

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

Color instance

>>> from spectrum.color import Color

>>> rgb_color = Color('#FFFF00')
>>> print(rgb_color)
#FFFF00

>>> rgba_color = Color('#FFFF00', 0.5)
>>> print(rgba_color)
rgba(255,255,0,0.5)

>>> print(rgba_color.hex_code)
FFFF00

>>> print(rgba_color.hex)
#FFFF00

>>> print(rgba_color.opacity)
0.5

License

Copyright (c) 2018 Mihail Mishakin Released under the MIT license (see LICENSE)

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

django-spectrum-0.0.1.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_spectrum-0.0.1-py2.py3-none-any.whl (7.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file django-spectrum-0.0.1.tar.gz.

File metadata

  • Download URL: django-spectrum-0.0.1.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.7

File hashes

Hashes for django-spectrum-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b9536876a453452b462d222bccdef0c82db0e7dac3ec1e6b75e034315b070318
MD5 0a35bc73213da7703e4fcbbf9e9bc269
BLAKE2b-256 2ea03b5eb758905dc025194ebf5d587cfee5dd8c583450d010e17d01034e5cf9

See more details on using hashes here.

File details

Details for the file django_spectrum-0.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: django_spectrum-0.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.7

File hashes

Hashes for django_spectrum-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 23165f9dd4743e56a3b32128ce46b9b77b71c163f5d1e8e24e41f9f3f34be858
MD5 02832a1c09852558d29f4e200350e0b0
BLAKE2b-256 7978dd7ff804b21594e43c633487ffa612610c8c02adb48296e9fb015d395175

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page