// Based on: http://processing.org/learning/basics/colorwheel.html int segs = 12; int steps = 32; float rotAdjust = radians(360.0 / segs / 2.0); float radius = 95.0; float segWidth = radius / steps; float interval = TWO_PI / segs; int SHADE = 0; int TINT = 1; void setup(){ size(250, 250); background(150); smooth(); ellipseMode(RADIUS); noStroke(); // You can substitue TINT for SHADE argument createWheel(width/2, height/2, SHADE); } void createWheel(int x, int y, int valueShift){ if (valueShift == SHADE){ for (int j = 0; j < steps; j++){ color[] cols = { color(255-(255/steps)*j, 255-(255/steps)*j, 0), color(255-(255/steps)*j, (255/1.5)-((255/1.5)/steps)*j, 0), color(255-(255/steps)*j, (255/2)-((255/2)/steps)*j, 0), color(255-(255/steps)*j, (255/2.5)-((255/2.5)/steps)*j, 0), color(255-(255/steps)*j, 0, 0), color(255-(255/steps)*j, 0, (255/2)-((255/2)/steps)*j), color(255-(255/steps)*j, 0, 255-(255/steps)*j), color((255/2)-((255/2)/steps)*j, 0, 255-(255/steps)*j), color(0, 0, 255-(255/steps)*j), color(0, 255-(255/steps)*j, (255/2.5)-((255/2.5)/steps)*j), color(0, 255-(255/steps)*j, 0), color((255/2)-((255/2)/steps)*j, 255-(255/steps)*j, 0) }; for (int i = 0; i < segs; i++){ fill(cols[i]); arc(x, y, radius, radius, interval*i+rotAdjust, interval*(i+1)+rotAdjust); } radius -= segWidth; } } else if (valueShift == TINT){ for (int j = 0; j < steps; j++){ color[]cols = { color((255/steps)*j, (255/steps)*j, 0), color((255/steps)*j, ((255/1.5)/steps)*j, 0), color((255/steps)*j, ((255/2)/steps)*j, 0), color((255/steps)*j, ((255/2.5)/steps)*j, 0), color((255/steps)*j, 0, 0), color((255/steps)*j, 0, ((255/2)/steps)*j), color((255/steps)*j, 0, (255/steps)*j), color(((255/2)/steps)*j, 0, (255/steps)*j), color(0, 0, (255/steps)*j), color(0, (255/steps)*j, ((255/2.5)/steps)*j), color(0, (255/steps)*j, 0), color(((255/2)/steps)*j, (255/steps)*j, 0) }; for (int i = 0; i < segs; i++){ fill(cols[i]); arc(x, y, radius, radius, interval*i+rotAdjust, interval*(i+1)+rotAdjust); } radius -= segWidth; } } }