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
Methods
@:value({ w : 0, z : 0, y : 0, x : 0 })@:implinlineset (this:Vec4, x:Float = 0, y:Float = 0, z:Float = 0):Color
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(new Map())staticPALETTE:Map<String, Color> = new Map()
@:value([1, 0, 0, 1])staticRED:Color = [1, 0, 0, 1]
@:value([1, 1, 1, 1])staticWHITE:Color = [1, 1, 1, 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