A color abstract of Vec4

Usage:

  • Initialize using Color.get() var color = Color.get(1, 0, 0, 1); // red
  • Or with an array var color:Color = [0, 1, 0, 1]; // green
  • Or using a 32 bit Integer var color = Color.get().from_int32(0xFF0000FF); // blue
  • Get/set various details like color.hue, color.saturation, and more
  • Swizzle like you're using GLSL! var yellow = red.rrba;
  • Register and use colors in a global palette Color.PALETTE.set('pico 8 red', Color.get().from_int32(0xFFFF004D)); / var red = Color.PALETTE['pico 8 red'];
  • Recycle colors when you're done with them: my_color.put()

Variables

@:implalpha:Float

@:implalpha_int:Int

@:implblue:Float

@:implblue_int:Int

@:implbrightness:Float

@:implgreen:Float

@:implgreen_int:Int

@:implhue:Float

@:impllightness:Float

@:implred:Float

@:implred_int:Int

@:implsaturation:Float

Methods

@:implinlineequals (this:Vec4):Bool

@:implinlinefrom_int32 (this:Vec4):Color

@:implinlineput ():Void

@:value({ w : 0, z : 0, y : 0, x : 0 })@:implinlineset (this:Vec4, x:Float = 0, y:Float = 0, z:Float = 0):Color

@:implset_HSL (this:Vec4, h:Float, s:Float):Color

@:implset_HSV (this:Vec4, h:Float, s:Float):Color

@:implset_from_hue (this:Vec4):Color

@:impltoString ():String

@:implinlineto_hex ():Int

Static variables

@:value([0, 0, 0, 1])staticBLACK:Color = [0, 0, 0, 1]

@:value([0, 0, 1, 1])staticBLUE:Color = [0, 0, 1, 1]

@:value([0, 1, 1, 1])staticCYAN:Color = [0, 1, 1, 1]

@:value([0, 1, 0, 1])staticGREEN:Color = [0, 1, 0, 1]

@:value([0.5, 0.5, 0.5, 1])staticGREY:Color = [0.5, 0.5, 0.5, 1]

@:value([1, 0, 1, 1])staticMAGENTA:Color = [1, 0, 1, 1]

@:value(new Map())staticPALETTE:Map<String, Color> = new Map()

@:value([1, 0, 0, 1])staticRED:Color = [1, 0, 0, 1]

@:value([1, 1, 1, 0])staticTRANSPARENT:Color = [1, 1, 1, 0]

@:value([1, 1, 1, 1])staticWHITE:Color = [1, 1, 1, 1]

@:value([1, 1, 0, 1])staticYELLOW:Color = [1, 1, 0, 1]

Static methods

@:value({ alpha : 1, blue : 0, green : 0, red : 0 })staticget (red:Float = 0, green:Float = 0, blue:Float = 0, alpha:Float = 1):Color