Hello @Erif ,
You can also fill() a vertex in a shape.
There is a cool example that comes with Processing in:
File > Examples … > Topics> Geometry > RGBCube
An example I cooked up:
// Gradient Shape
// v1.0.0
// GLV 2022-12-03
void setup()
{
size(800, 400, P2D);
noStroke();
}
void draw()
{
background(0);
colorMode(RGB);
translate(width/4, height/2);
beginShape(QUADS);
fill(0, 255, 255); vertex(-150, 150);
fill(255, 255, 255); vertex( 150, 150);
fill(255, 0, 255); vertex( 150, -150);
fill(0, 0, 255); vertex(-150, -150);
endShape();
translate(width/2, 0);
colorMode(HSB, 360, 100, 100);
beginShape(QUADS);
fill((frameCount+0)%360, 100, 100); vertex(-150, 150);
fill((frameCount+90)%360, 100, 100); vertex( 150, 150);
fill((frameCount+180)%360, 100, 100); vertex( 150, -150);
fill((frameCount+270)%360, 100, 100); vertex(-150, -150);
endShape();
}
:)