Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...

PixiPlugin.parseColor()

PixiPlugin.parseColor( ) : Array | Number

Returns : Array | Number

By default, an array containing the red, green, and blue (and optionally alpha) components in that order, or if the format parameter was "hsl", the array will contain the hue, saturation and lightness (and optionally alpha) components in that order. Or if format is defined as "number", it’ll return a number like 0xFF0000.

Details

Parses a color (like "#9F0", "#FF9900", "rgb(255,51,153)", or "hsl(108, 50%, 10%)") into an array containing the red, green, and blue (and optionally alpha) components in that order, or if the format parameter was "hsl", the array will contain the hue, saturation and lightness (and optionally alpha) components in that order. Or if format is defined as "number", it’ll return a number like 0xFF0000.

If a relative value is found in an hsl() or hsla() string, it will preserve those relative prefixes and all the values in the array will be strings instead of numbers (in all other cases the array will be populated with numbers). This is a useful method for converting color-related values into data that’s more useful. PixiJS, for example, requires numeric values for most of its color-related values so it would be cumbersome to use "purple" or "#F00", for example, without this method.

Copyright 2017, GreenSock. All rights reserved. This work is subject to theterms of useor for Club GreenSock members, the software agreement that was issued with the membership.
×