- Each color stores the color mode and level maxes that applied at the time of its construction.
- These are used to interpret the input arguments (at construction and later for that instance of color) and to format the output e.g. when saturation() is requested.
- Internally we store an array representing the ideal RGBA values in floating point form, normalized from 0 to 1.
- From this we calculate the closest screen color (RGBA levels from 0 to 255) and expose this to the renderer.
- We also cache normalized, floating point components of the color in various representations as they are calculated.
- This is done to prevent repeating a conversion that has already been performed.
Esempi
c=new p5.Color();
Metodi
- c.toString()
- c.setRed(255)
- c.setGreen(255)
- c.setBlue(255)
- c.setAlpha(1)