colorgram.py
colorgram.py copied to clipboard
hex property for Color objects
I'd like to have an extra .hex
property in the Color object, that contains a string representing the hexadecimal color code.
eg.
>>> print(my_color.hex)
'#0A1FB5'
I first thought I needed this too, but then remembered that CSS supports RGB colors too. So converting a Color object to one usable in CSS is just:
css_color = f"rgb({color.rgb.r}, {color.rgb.g}, {color.rgb.b})"
I would second this, but also include HSB/HSV, HCL, HCB/HCV, YCbCr, YCoCg, and others. Who wanna do a pull request? This should be easy as PIE