Setting to an instance of Color will copy its color source and components.
Otherwise, Color will try to normalize the color source and set the components.
If the color source is invalid, an Error will be thrown and the Color will left unchanged.
Note: The null in the setter's parameter type is added to match the TypeScript rule: return type of getter
must be assignable to its setter's parameter type. Setting value to null will throw an Error.
When getting:
A return value of null means the previous value was overridden (e.g., PIXI.Color.multiply multiply,
PIXI.Color.premultiply premultiply or PIXI.Color.round round).
Otherwise, the color source used when setting is returned.
Converts color to a premultiplied alpha format. This action is destructive, and will
override the previous value property to be null.
Parameters
alpha: number
The alpha to multiply by.
OptionalapplyToRGB: boolean
Whether to premultiply RGB channels.
Returns this
Itself.
round
round(steps:number):this
Rounds the specified color according to the step. This action is destructive, and will
override the previous value property to be null. The alpha component is not rounded.
Parameters
steps: number
Number of steps which will be used as a cap when rounding colors
Color utility class.
Example
Memberof
PIXI
Since
7.2.0