Open giorg opened 8 years ago
Hi @giorg, I'm not sure I understand your request. You'd like to store the data as rgb(1,2,3)
?
Hi, first of all thanks for this cool plugin, it works perfectly. What I need is: when I define in my model
color = RGBColorField(null=True, blank=True)
then when in the admin I choose a color it is saved in my color field as hexadecimal. Is it possible to store it as "45,21,34" for example?
thanks a lot
I think it would require some work but It could be possible.
If you're interested on working a patch that adds a kwarg
to RGBColorFIeld
to opt-in this feature I'd be happy to review it.
Is there still interest in making RGB values an option? If so, the best option might be to use a different jQuery color picker.
Looking through the code I found this block. The current picker is converting all RGB values to hex.
A picker like this would provide the option to use many different color formats. The issue would be whether or not changing the color picker could be done in a non-breaking way.
I'd be willing to attempt these changes if there's any interest with such a change?
@smarlowucf a patch is welcome but I believe the requested feature was to make the RGBColor
database field return a tri-truple instead of a string.
Okay, the initial question made me think rgb stored as a string rgb(1,2,3) rather than a tuple (1,2,3).
Migrating to a new jQuery color picker will likely cause some major functionality changes that may be unwanted. The current picker displays a set of colors to be chosen, whereas other pickers I've found provide a palette of colors to choose from. So no input of a colors list would be needed.
Also, CSS expects color formats as strings so sticking to that format seems like an easier option if the color field value is used on the frontend. http://www.w3schools.com/cssref/css_colors_legal.asp
In either case it seems like choosing a JS color picker that supports the wanted color formats is a better option than converting the format on the backend. However, if a color list is wanted the picker I suggested above is not a good option.
If someone does undertake this work, please consider offering both RGB and RGBA values (with or without alpha).
Hi, is it possible to have rgb code instead of hex in return? thanks