Color spectrum

Hello. I am trying to generate a spectrum color as a texture starting to 0, 0 (pure white) to integers screenWidth and screenHeight (black). My texture is pixelated and each pixel can be “painted” using a single loop. So I have something like that :

for (int x = 0; x < ScreenWidth(); x++)
{
    for (int y = 0; y < ScreenHeight(); y++)
    {          
        r = uint8_t for red
        g = uint8_t for green
        b = uint8_t for blue

        Draw(coordinate x&y),PaintPixel(r, g, b));
   }
}

How should I compute R, G and B in order to reach this picture as a example :

Thank you for your help ++

I think you can cycle between RGB and HSV with the Color class.

and

Thank you Kurt-Dekker. Again you gave me some good tips and I really appreciate. According to your explaination, I found and converted this function from C++. It allows to draw a full color spectrum. It works fine now ++

1 Like

Done. Thank you ++