I have small set of color data that I want to investigate. It is in the form of a list of RGB data.
[(255, 255, 255), (124, 144, 231), ...]
The image uses a restricted palette, and I would like to see how these colors are "distributed" by plotting them along the color wheel. As alternative, I tried histogram of individual channels, but this did not give me the insight I am interested in.
I googled and learned that HSL color more accurately maps to color wheel. However, after converting to HSL, I'm still confused. 3 pieces of data still make up the color: Hue, saturation, and luminosity. How do you map 3 piece of data onto a 2d plane?
I read about polar coordinates here: https://www.mathsisfun.com/polar-cartesian-coordinates.html. I try ignoring luminosity and plotting by treating HSL data as Polar coordinate (hue = angle, saturation = length of radius (scaled by some factor))
def polar2cartesian(hsl):
color_circle_radius = 100
radius = hsl.saturation * color_circle_radius
x = radius * math.cos(math.radians(hsl.hue))
y = radius * math.sin(math.radians(hsl.hue))
return x, y
...
for hsl in colors:
x, y = polar2cartesian(hsl)
im.point(x, y, hsl.to_rgb())
This is not correct result. As it shows same red color hue in multiple places like this example:
What is the correct way to translate from RGB to a position on color wheel?
colorsys
module? – martineauim.point
do with negativex
,y
values? – Cris Luengo