mirror of
https://github.com/processing/processing4.git
synced 2026-02-12 10:00:42 +01:00
92 lines
2.2 KiB
XML
92 lines
2.2 KiB
XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
<root>
|
|
<name>colorMode()</name>
|
|
|
|
<category>Color</category>
|
|
|
|
<subcategory>Setting</subcategory>
|
|
|
|
<usage>Web & Application</usage>
|
|
|
|
<example>
|
|
<image>colorMode_.jpg</image>
|
|
<code>
|
|
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);
|
|
}
|
|
}
|
|
</code>
|
|
</example>
|
|
|
|
<example>
|
|
<image>colorMode_2.jpg</image>
|
|
<code>
|
|
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);
|
|
}
|
|
}
|
|
</code>
|
|
</example>
|
|
|
|
<description>
|
|
Changes the way Processing interprets color data. By default, <b>fill()</b>, <b>stroke()</b>, and <b>background()</b> 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 <b>colorMode(RGB, 1.0)</b> 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.
|
|
</description>
|
|
|
|
<syntax>
|
|
colorMode(<c>mode</c>);
|
|
colorMode(<c>mode</c>, <c>range</c>);
|
|
colorMode(<c>mode</c>, <c>range1</c>, <c>range2</c>, <c>range3</c>);
|
|
</syntax>
|
|
|
|
<parameter>
|
|
<label>mode</label>
|
|
<description>Either RGB or HSB, corresponding to Red/Green/Blue and Hue/Saturation/Brightness</description>
|
|
</parameter>
|
|
|
|
<parameter>
|
|
<label>range</label>
|
|
<description>int or float: range for all color elements</description>
|
|
</parameter>
|
|
|
|
<parameter>
|
|
<label>range1</label>
|
|
<description>int or float: range for the red or hue depending on the current color mode</description>
|
|
</parameter>
|
|
|
|
<parameter>
|
|
<label>range2</label>
|
|
<description>int or float: range for the green or saturation depending on the current color mode</description>
|
|
</parameter>
|
|
|
|
<parameter>
|
|
<label>range3</label>
|
|
<description>int or float: range for the blue or brightness depending on the current color mode</description>
|
|
</parameter>
|
|
|
|
<returns>None</returns>
|
|
|
|
<related>
|
|
background()
|
|
fill()
|
|
stroke()
|
|
</related>
|
|
|
|
<availability>1.0</availability>
|
|
|
|
<type>Function</type>
|
|
|
|
<partof>Core</partof>
|
|
|
|
<level>Extended</level>
|
|
|
|
|
|
</root>
|