Reference for Processing version 1.2. If you have a previous version, use the reference included with your software. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Javadoc.

Name

stroke()

Examples
example pic
stroke(153);
rect(30, 20, 55, 55);
example pic
stroke(204, 102, 0);
rect(30, 20, 55, 55);
Description Sets the color used to draw lines and borders around shapes. This color is either specified in terms of the RGB or HSB color depending on the current colorMode() (the default color space is RGB, with each value in the range from 0 to 255).

When using hexadecimal notation to specify a color, use "#" or "0x" before the values (e.g. #CCFFAA, 0xFFCCFFAA). The # syntax uses six digits to specify a color (the way colors are specified in HTML and CSS). When using the hexadecimal notation starting with "0x", the hexadecimal value must be specified with eight characters; the first two characters define the alpha component and the remainder the red, green, and blue components.

The value for the parameter "gray" must be less than or equal to the current maximum value as specified by colorMode(). The default maximum value is 255.
Syntax
stroke(gray)
stroke(gray, alpha)
stroke(value1, value2, value3)
stroke(value1, value2, value3, alpha)
stroke(color)
stroke(color, alpha)
stroke(hex)
stroke(hex, alpha)
Parameters
gray int or float: specifies a value between white and black
alpha int or float: opacity of the stroke
value1 int or float: red or hue value (depending on the current color mode)
value2 int or float: green or saturation value (depending on the current color mode)
value3 int or float: blue or brightness value (depending on the current color mode)
color color: any value of the color datatype
hex int: color value in hexadecimal notation (i.e. #FFCC00 or 0xFFFFCC00)
Returns None
Usage Web & Application
Related noStroke()
fill()
tint()
background()
colorMode()
Updated on June 14, 2010 12:05:29pm EDT

Creative Commons License