Skip to main content

Color fields for Django models and forms using HTML5 native color type input elements

Project description

Color fields for forms and models using HTML5’s native input element of type color.

Quickstart

Install django-colorinput and add it to your INSTALLED_APPS:

INSTALLED_APPS = (
    
    'colorinput.apps.ColorInputConfig',
    
)

Now you can use ColorField in your models:

from django.db import models

from colorinput.models import ColorField

class MyModel(models.Model):
    
    color = ColorField(default="d0d0d0")
    

In forms, the color field will be displayed using HTML5’s native color type input element. In your own templates, you could use the value stored in the field like this:

<span style="color: #{{ object.color }}">

… or however you want, really. Just keep in mind that the value is stored as RGB in triple HEX format without the leading “#” (hash symbol).

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-colorinput, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size django_colorinput-0.2-py3-none-any.whl (15.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size django-colorinput-0.2.tar.gz (13.9 kB) File type Source Python version None Upload date Hashes View

Supported by

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