/* 6.914, Example 2.2 0) Another way to think about color: Instead of creating colors as combinations of red, green, and blue, you can change colorMode (default is RGB) to HSB, for hue, saturation, brightness. Now, creating new colors will use those three parameters. 1)You can also use extra arguments to colorMode to specify color ranges. Instead of giving all of your values (RGB, HSB, RGBA, and HSBA - the last two include alpha values) in the 0-255 range, you can give them in the 0-x range by using an argument like this: // RGB values in the 0-1.0 range, normalized from 0-255 range. colorMode(RGB, 1.0); // HSB values in the 0-5.0 range colorMode(HSB, 5.0); // red in 0-1 range, green in 0-5 range, blue in 10.0 range colorMode(RGB, 1.0, 5.0, 10.0); // hue, brightness, and saturation in 0-5 range; alpha in 0-10 range colorMode(HSB, 5.0, 5.0, 5.0, 10.0); */ void setup(){ size(200, 200); noStroke(); } void draw() { colorMode(RGB, 255); // this is the default background(255); colorMode(RGB, 100); for(int i=0; i<100; i++) { for(int j=0; j<100; j++) { stroke(i, j, 0); // blue is constant point(i, j); } } colorMode(HSB, 100); for(int i=0; i<100; i++) { for(int j=0; j<100; j++) { stroke(i, j, 100); // brightness is constant point(100+i, 100+j); } } }