setRgb()
The setRgb
function allows you to modify the RGB (Red, Green, Blue) values of a color object.
This function returns a new Spectrum
instance with the updated RGB values.
Usage
Parameters
setRgb(colorObj, options)
Parameter | Type | Required | Valid range | Description |
---|---|---|---|---|
colorObj | Spectrum instance | true | - | The Spectrum instance representing the color you want to modify |
options.red | number | false | [0; 255] | The value that will be set as a red channel value |
options.green | number | false | [0; 255] | The value that will be set as a green channel value |
options.blue | number | false | [0; 255] | The value that will be set as a blue channel value |
options.alpha | number | false | [0; 1] or ['0%'; '100%'] | The value that will be set as an alpha value |
Return Value
The setRgb
function returns a new Spectrum
instance with the modified RGB values.