Optional
value: ColorSourceOptional value to use, if not provided, white is used.
Static
Readonly
sharedDefault Color object for static uses
import { Color } from 'pixi.js';
Color.shared.setValue(0xffffff).toHex(); // '#ffffff'
Get alpha component (0 - 1)
Get blue component (0 - 1)
Get green component (0 - 1)
Get red component (0 - 1)
The current color source.
When setting:
Color
will copy its color source and components.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:
null
means the previous value was overridden (e.g., PIXI.Color.multiply multiply,
PIXI.Color.premultiply premultiply or PIXI.Color.round round).Multiply with another color. This action is destructive, and will
override the previous value
property to be null
.
The color to multiply by.
Converts color to a premultiplied alpha format. This action is destructive, and will
override the previous value
property to be null
.
The alpha to multiply by.
Optional
applyToRGB: booleanWhether to premultiply RGB channels.
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.
Number of steps which will be used as a cap when rounding colors
since 7.3.0
Set the value, suitable for chaining
PIXI.Color.value
Generated using TypeDoc
Color utility class.
Example
Memberof
PIXI
Since
7.2.0