fabiocaccamo / django-colorfield

:art: color field for django models with a nice color-picker in the admin.
MIT License
632 stars 95 forks source link

Crash when using `image_field` with RGB/RGBA formats #153

Closed browniebroke closed 1 year ago

browniebroke commented 1 year ago

Python version n/a

Django version n/a

Package version 0.10.0

Current behavior (bug description) The recently added feature for RGB & RGBA doesn't work with the image_field feature. Issue noted https://github.com/fabiocaccamo/django-colorfield/issues/151#issuecomment-1706132604

I realized just now that RGB and RGBA formats raise an error when the image_field option is used: https://github.com/fabiocaccamo/django-colorfield#image_field

This happens because the color returned by get_image_background_color (https://github.com/fabiocaccamo/django-colorfield/blob/main/colorfield/utils.py#L4) is always in HEX / HEXA format.

Expected behavior RGB/RGBA format should work with image_field.

Upvote & Fund

Fund with Polar

fabiocaccamo commented 1 year ago

Thank you for the PR, fix available in 0.10.1 version.