Although any RGB configuration can be used as a color, 139 web safe colors are treated as objects with color name, hex value, and red, green, and blue values as parameters. Examples:
// new Color ("black", "000000", 0, 0, 0);
// new Color ("white", "FFFFFF", 255, 255, 255);
Color objects are grouped into arrays. There are 11 groups total.
// blacks, 10 colors
// whites, 17 colors
// browns, 17 colors
// reds, 9 colors
// pinks, 6 colors
// oranges, 5 colors
// yellows, 11 colors
// greens, 20 colors
// cyans, 11 colors
// blues, 15 colors
// purples, 18 colors
There is a function to randomize all colors.
There are also functions to randomize colors within each specific color group.
To make linear and radial gradients, the createLinearGradient, createRadialGradient, and addColorStop methods were simply wrapped in functions. The LinearGradient function takes three colors (c1, c2, c3) as parameters, and the RadialGradient function takes only two (c1, c2). The height and width of the gradient are determined by the size of the canvas.
//HorizontalGradient (c1, c2, c3);
//VerticalGradient (c1, c2, c3);
//DiagonalGradient (c1, c2, c3);
Most functions take parameters (c1, c2) for color selection.
//c1 — fill color
//c2 — stroke color
Functions including color parameters can take any color, not just those included as objects in my code. These functions can also take value strings of “random” and “clear” for either or both fill or stroke.
// “random” will evoke the RandomColor() function to return a random color.
// “clear” will simply set the fill or stroke to the background color.
Expansion for color harmony began December 2019.