| Language \ Environment \ Comparison |

| Index

| The Processing 1.0 _ALPHA_ Reference is a work in progress. If you see any errors or have any comments, please write to: reas at groupc.net

Name |  | ### colorMode()
Examples |  |
    noStroke();
    colorMode(RGB, 100);
    for(int i=0; i<100; i++) {
      for(int j=0; j<100; j++) {
        stroke(i, j, 0);
        point(i, j);
      }
    }
    noStroke();
    colorMode(HSB, 100);
    for(int i=0; i<100; i++) {
      for(int j=0; j<100; j++) {
        stroke(i, j, 100);
        point(i, j);
      }
    }
Description |  | Changes the way Processing interprets color data. By default, fill(), stroke(), and background() colors are set by values between 0 and 255 using the RGB color model. It is possible to change the numerical range used for specifying colors and to switch color systems. For example, calling colorMode(RGB, 1.0) will specify that values are specified between 0 and 1. The limits for defining colors are altered by setting the parameters range1, range2, and range 3.
Syntax |  |
    colorMode(mode);
    colorMode(mode, range);
    colorMode(mode, range1, range2, range3);
Parameters |  |
mode |  | Either RGB or HSB, corresponding to Red/Green/Blue and Hue/Saturation/Brightness
range |  | int or float: range for all color elements
range1 |  | int or float: range for the red or hue depending on the current color mode
range2 |  | int or float: range for the green or saturation depending on the current color mode
range3 |  | int or float: range for the blue or brightness depending on the current color mode
Returns |  | None
Usage |  | Web & Application
Related |  | background() fill() stroke()

| © 2004 - 2001 Massachusetts Institute of Technology and Interaction Design Institute Ivrea |
| Processing is an open project initiated by Ben Fry and Casey Reas |