ColorAide is a pure Python, object oriented approach to colors.
>>> from coloraide import Color
>>> c = Color("red")
>>> c.to_string()
'rgb(255 0 0)'
>>> c.convert('hsl').to_string()
'hsl(0 100% 50%)'
>>> c.set("lch.chroma", 30).to_string()
'rgb(173.81 114.29 97.218)'
>>> Color("blue").mix("yellow", space="lch").to_string()
'rgb(255 65.751 107.47)'
ColorAide particularly has a focus on the following:
Accurate colors.
Proper round tripping (where reasonable).
Be generally easy to pick up for the average user.
Support modern CSS color spaces and syntax.
Make accessible many new and old non-CSS color spaces.
Provide a number of useful utilities such as interpolation, color distancing, blending, gamut mapping, filters, correlated color temperature, color vision deficiency simulation, etc.
Provide a plugin API to extend supported color spaces and approaches to various utilities.
Allow users to configure defaults to their liking.
With ColorAide, you can specify a color, convert it to other color spaces, mix it with other colors, output it in different CSS formats, and much more!
https://facelessuser.github.io/coloraide
MIT