-
Notifications
You must be signed in to change notification settings - Fork 9
Color
Will Blanton edited this page Sep 13, 2019
·
1 revision
A Color abstract of Vec4
Usage:
var red = Color.get(1, 0, 0, 1); // initialize using get()
var green:Color = [0, 1, 0, 1]; // initialize using an array
var blue = Color.get().from_int32(0xFF0000FF); // get color from int32 (0xAARRGGBB)
// get various details
trace(red.saturation); // 1
trace(green.hue); // 120
trace(blue.lightness); // 0.5
red.hue += 240; // and set them inline!
trace(red.equals(blue)); // true
red.hue = 0; // reset red back to red
// Swizzling!
trace(red.grba.equals(green)); // true
Color.PALETTE.set('red', red); // Register and use colors in a global palette!
trace(Color.PALETTE['red']); // r: 1 | g: 0 | b: 0 | a: 1 | #FFFF0000
// Recycle when done!
red.put();
green.put();
blue.put();
For more info, please check out the API: http://01010111.com/zerolib/