Skip to content

Instantly share code, notes, and snippets.

@samme
Last active January 23, 2020 01:24
Show Gist options
  • Save samme/f414e31d9af75d6e4f01921ad4a8e1a1 to your computer and use it in GitHub Desktop.
Save samme/f414e31d9af75d6e4f01921ad4a8e1a1 to your computer and use it in GitHub Desktop.
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