Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

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 >= 1.11
  • 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 BSD 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.

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

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page