Django color picker -- ColorField?

1,046 views
Skip to first unread message

inquis

unread,
Oct 15, 2006, 3:03:57 PM10/15/06
to Django users
Is there any interest in a Django field type that will accept and
validate a set of RGB color values? It could be represented in the
Django admin using a Javascript color picker.

Has this been done before? My searches were all for naught.

Noah

unread,
Oct 19, 2006, 7:36:56 PM10/19/06
to Django users
I'd totaly be interested in that. If someone wanted to write the
appropriet code it would also be useful to be able to filter by related
colors somehow.

Frankie Robertson

unread,
Oct 20, 2006, 5:43:22 AM10/20/06
to django...@googlegroups.com
On 15/10/06, inquis <inq...@gmail.com> wrote:
>
> Is there any interest in a Django field type that will accept and
> validate a set of RGB color values? It could be represented in the
> Django admin using a Javascript color picker.

I'm interested in it as it might be something I'd use in a planned
future project. Seems like a good idea. Something that may very well
end up somewhere in the project its self if done well. How could you
store in in the database? It's 24bit so maybe 3 (one for each of RGB)
8bit fields would do the trick? Unfortunately creating you're own
Fields is undocumented at the moment but I'm sure you could reverse
engineer it without too much trouble.

ogghead

unread,
Oct 20, 2006, 11:42:51 AM10/20/06
to Django users
I would definitely use a Django "ColorField" type with a JavaScript
editor.

I currently do something similar in wxPython apps, using my own
ColourGridCellEditor/Renderer classes. We store colors in the database
as CHAR(11) RGB strings: "204,153,102". Perhaps you could subclass
Django's CommaSeparatedIntegerField?

zenx

unread,
Oct 20, 2006, 3:44:21 PM10/20/06
to Django users
It would be cool if the javascript widget also displayed the
hexadecimal color (like #FFFFFF) calculating it real time from the RGB
selected color. It will be also interesting if people could get the
RGB, hex, etc. color by different methods (not only rgb).

Reply all
Reply to author
Forward
0 new messages