Skip to main content

A ColorField to save Colors in RGB array in postgresql.

Project description

# Django Postgresql RGB ColorField

This is a ColorField based on django's `django.contrib.postgres.ArrayField`. Though it shows Hex in admin and let you pick color, it is saving its value as a RGB array. Which is perticularly useful if you want to do query and calculation over it. e.g. Getting colors close to another.

### Requirements

1. Python 3.X
2. Postgresql database in django.

### Installation

pip install django-postgresql-rgb-colorfield

### Quick start

1. Add `colorfield` to your INSTALLED_APPS setting like this:


2. Import and Use `ColorField`:

from django.db import models
from colorfield.fields import ColorField
# Create your models here.

class ColorPallate(models.Model):
color1 = ColorField(null=True, blank=True)
color2 = ColorField(null=True, blank=True)
color3 = ColorField(null=True, blank=True)

def __str__(self):
return f"Pallate {}"

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-postgresql-rgb-colorfield-1.3.0.tar.gz (23.4 kB view hashes)

Uploaded source

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