A ColorField to save Colors in RGB array in postgresql.
Project description
=====
Django Postgresql RGB ColorField
=====
This is a ColorField based on django's `from 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.
Quick start
-----------
1. Add "polls" to your INSTALLED_APPS setting like this:
.. code:: python
INSTALLED_APPS = [
...
'colorfield',
]
2. Import and Use `ColorField`:
.. code:: python
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 {self.id}"
Django Postgresql RGB ColorField
=====
This is a ColorField based on django's `from 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.
Quick start
-----------
1. Add "polls" to your INSTALLED_APPS setting like this:
.. code:: python
INSTALLED_APPS = [
...
'colorfield',
]
2. Import and Use `ColorField`:
.. code:: python
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 {self.id}"
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
Close
Hashes for django-postgresql-rgb-colorfield-1.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c46aa73f802621aecf3ccf8a00c9817ece343505d235d41aaf3b91fb3180a9f4 |
|
MD5 | 8fb6de5e2ec3dbc54f83213390941f62 |
|
BLAKE2b-256 | 2654b0c46cbe77f8b081e1dac289071e3f134d972ffcf5504d2774ef9b930b41 |