I am attempting to generate a color wheel, but in RYB space. I have successfully implemented this in RGB. I start off with Red (255, 0, 0) and convert it to HSL, increment the hue value, then convert back to display on screen. The details are described here: https://serennu.com/colour/rgbtohsl.php However, my attempts at doing so with RYB have not worked so far.
From what I have read, you get a value in RGB, such as Red (255, 0, 0). Then you ASSUME that it's RYB and use the code below to convert that "RYB" value to RGB. Then, what I have done is gotten that value, converted it to HSL, incremented the Hue, and then displayed it on the screen as before.
def _cubic(t, a, b):
weight = t * t * (3 - 2*t)
return a + weight * (b - a)
def ryb_to_rgb(r, y, b): # Assumption: r, y, b in [0, 1]
# red
x0, x1 = _cubic(b, 1.0, 0.163), _cubic(b, 1.0, 0.0)
x2, x3 = _cubic(b, 1.0, 0.5), _cubic(b, 1.0, 0.2)
y0, y1 = _cubic(y, x0, x1), _cubic(y, x2, x3)
red = _cubic(r, y0, y1)
# green
x0, x1 = _cubic(b, 1.0, 0.373), _cubic(b, 1.0, 0.66)
x2, x3 = _cubic(b, 0., 0.), _cubic(b, 0.5, 0.094)
y0, y1 = _cubic(y, x0, x1), _cubic(y, x2, x3)
green = _cubic(r, y0, y1)
# blue
x0, x1 = _cubic(b, 1.0, 0.6), _cubic(b, 0.0, 0.2)
x2, x3 = _cubic(b, 0.0, 0.5), _cubic(b, 0.0, 0.0)
y0, y1 = _cubic(y, x0, x1), _cubic(y, x2, x3)
blue = _cubic(r, y0, y1)
return (red, green, blue)
I expect to get the RYB color wheel as described here: Calculating the analogous color with python I have followed the instructions on this post, and still am getting the wrong colors. I have tested this algorithm on a linear path (not a circle) to get http://prntscr.com/o3gcjr This looks similar to the color wheel on that post I linked to above. However, when starting the wheel from a different color, I get this http://prntscr.com/o3gp76 And in my opinion, that doesn't seem correct.