SWColor from TNT, is a SketchWave (SW) class for representing colors in HSB (Hue, Saturation, Brightness) color space, with optional alpha transparency, within a p5js application.
- Constructor:
new SWColor(h, s, b, a, name)
- Properties:
h (hue, 0-360), s (saturation, 0-100), b (brightness, 0-100), a (alpha, 0-100), name (optional label)
- Methods:
darkenBy(factor), brightenBy(factor)
saturateBy(factor), desaturateBy(factor)
setAlphaTo(a), changeAlphaBy(factor)
getHexStr(), getRGBStr()
createDarkerColor(factor), createLighterColor(factor)
- Usage: Use SWColor for custom colors, gradients, and dynamic color effects in p5.js sketches.
For more details and examples, visit: SWColor Reference Page.
SWColor Demo Usage: Click on a color disk to select it, then use the sliders to adjust its saturation, brightness, and alpha transparency. Click a Disk label to reset the sliders, or click the 'Reset' button to restore all colors to their original values. Hex codes are provided for convenience next to the Disk labels.