[][src]Static p5_sys::global::fill

pub static fill: FillInternalType

Sets the color used to fill shapes. For example, if you run fill(204, 102, 0), all shapes drawn after the fill command will be filled with the color orange. 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). The alpha range by default is also 0 to 255.

If a single string argument is provided, RGB, RGBA and Hex CSS color strings and all named color strings are supported. In this case, an alpha number value as a second argument is not supported, the RGBA form should be used.

A p5 Color object can also be provided to set the fill color.

Examples

// Grayscale integer value
fill(51);
rect(20, 20, 60, 60);
// R, G & B integer values
fill(255, 204, 0);
rect(20, 20, 60, 60);
// H, S & B integer values
colorMode(HSB);
fill(255, 204, 100);
rect(20, 20, 60, 60);
// Named SVG/CSS color string
fill('red');
rect(20, 20, 60, 60);
// three-digit hexadecimal RGB notation
fill('#fae');
rect(20, 20, 60, 60);
// six-digit hexadecimal RGB notation
fill('#222222');
rect(20, 20, 60, 60);
// integer RGB notation
fill('rgb(0,255,0)');
rect(20, 20, 60, 60);
// integer RGBA notation
fill('rgba(0,255,0, 0.25)');
rect(20, 20, 60, 60);
// percentage RGB notation
fill('rgb(100%,0%,10%)');
rect(20, 20, 60, 60);
// percentage RGBA notation
fill('rgba(100%,0%,100%,0.5)');
rect(20, 20, 60, 60);
// p5 Color object
fill(color(0, 0, 255));
rect(20, 20, 60, 60);

Overloads

v1 red or hue value relative to the current color range

v2 green or saturation value relative to the current color range

v3 blue or brightness value relative to the current color range

alpha?


value a color string


gray a gray value

alpha?


values an array containing the red,green,blue & and alpha components of the color


color the fill color