1

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.

  • To me its seems just an approximation. one using 0 degree and one 360 (or near that degrees). In any case, when discussin colour, you should describe better your problem and assumptions. There are many different colour wheel definitions. RYB? It is used on other contexts. Are you assume same chromacities? (which make often not really sense). You should probably use colour spaces (and not colour models, RGB and RYB are colour models). CIEXYZ or CIELab are common working spaces to convert colour spaces. – Giacomo Catenazzi Jun 21 '19 at 11:33
  • 1
    The RYB color wheel is a thing used in many color scheme designing programs as it is a subtractive model unlike RGB. There are many programs that create the RYB color wheel. The benefit of RYB color wheels is that they are more useful to artists as they subtractive similar to colors in real life. Here is an example: https://www.sessions.edu/color-calculator/ – Hexyl Cinnamal Jun 21 '19 at 15:10

0 Answers0