Test Colors for MyCanvas

This page is intended has a number of tests to make sure that MyCanvas handles colors the same as the default canvas. In the canvas on the left, it is believed that every color alternative as demonstrated in the examples on the color() reference page are used for both fill() and stroke(). The 3 different canvas use different ways of specifying the background color.

 

color(gray, [alpha])
color(v1, v2, v3, [alpha])
color(value)
color(values)
color(color)
MyCanvas color is a helper method used by background, fill, and stroke. It uses the p5.js color function so any of the ways that one can normally specify a color should work with MyCanvas. But the p5 color function doesn't allow "null" arguments so _color sorts things out and passes only the desired arguments. Parameters:
gray Number: number specifying value between white and black. (normally 0-255)
alpha Number: alpha value relative to current color range (default is 0-255) (Optional)
v1 Number: red or hue value relative to the current color range (normally 0-255)
v2 Number: green or saturation value relative to the current color range (normally 0-255)
v3 Number: blue or brightness value relative to the current color range (normally 0-255)
value String: a color string (E.g. "yellow", "FF0" or "#FFFF00")
values Number[]: an array containing the red, green, blue & and alpha components of the color
color p5.Color
background(....)Any of ways that one specifies a color should work. However the image option is not implemented.
fill(...)Any of ways that one specifies a color should work.
noFill()
stroke(...)Any of ways that one specifies a color should work.
noStroke()
strokeWeight(weight)All widths are set in units of pixels.

Other methods used: createMyCanvas, background, text, line, and rect.

The p5.js file: testColors.pjs

James Brink, 5/13/2020