Skip to content

Instantly share code, notes, and snippets.

Last active Jan 23, 2020
What would you like to do?
Phaser.Display.Color conversions
input / output ColorObject Color† HSVColorObject number† string
(h: number, s: number, l: number) HSLToColor
(h: number, s: number, v: number) HSVToRGB HSVToRGB
(r: number, g: number, b: number, a: number) GetColor32
(r: number, g: number, b: number) RGBToHSV RGBToHSV GetColor RGBToString
ColorObject ObjectToColor, ValueToColor
string '#RGB' '#RRGGBB' HexStringToColor, ValueToColor
number 0xRRGGBB 0xAARRGGBB ColorToRGBA IntegerToColor, ValueToColor
string 'rgb(R,G,B)' 'rgba(R,G,B,A)' RGBStringToColor, ValueToColor

(†) You can also extract a number from Phaser.Display.Color#color or Phaser.Display.Color#color32.

ColorObject is type { r: number, g: number, b: number, a: number }.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment