class jive.Color

Color object to set color and alpha.

Authors firdosh, paling, n0rthwood, ngrebenshikov

Class Fields

static var BLACK:Color

static var BLUE:Color

static var CYAN:Color

static var DARK_GRAY:Color

static var GRAY:Color

static var GREEN:Color

static var HALO_BLUE:Color

static var HALO_GREEN:Color

static var HALO_ORANGE:Color

static var LIGHT_GRAY:Color

static var MAGENTA:Color

static var ORANGE:Color

static var PINK:Color

static var RED:Color

static var WHITE:Color

static var YELLOW:Color

static function getColor(r:Int, g:Int, b:Int, ?a:Float): Color

Returns a Color with the specified red, green, blue values in the range [0 - 255] and alpha value in range[0, 1].

r

red channel

g

green channel

b

blue channel

a

alpha channel

static function getColorBetween(begin:Color, end:Color, distance:Float): Color

static function getColorWithHLS(h:Float, l:Float, s:Float, ?a:Float): Color

Returns a Color with with the specified hue, luminance, saturation and alpha values in the range [0 - 1].

h

hue channel

l

luminance channel

s

saturation channel

a

alpha channel

static function getRGBWith(rr:Int, gg:Int, bb:Int): Int

Returns the RGB value representing the red, green, and blue values.

rr

red channel

gg

green channel

bb

blue channel

static function getWithARGB(argb:Int): Color

Returns a Color with specified ARGB uint value.

argb

ARGB value representing the color

returns

the Color

Instance Fields

var rgb:Int

function new(?rgb:Int, ?alpha:Float): Void

Create a Color

function brighter(?factor:Float): Color

Creates a new Color that is a brighter version of this Color. @see #darker()

factor

the birghter factor 0 to 1, default is 0.7

returns

a new Color object that is a brighter version of this Color.

function changeAlpha(newAlpha:Float): Color

Create a new Color with another alpha but same rgb.

newAlpha

the new alpha

returns

the new Color

function changeHue(newHue:Float): Color

Create a new Color with just change hue channel value.

newHue

the new hue value

returns

the new Color

function changeLuminance(newLuminance:Float): Color

Create a new Color with just change luminance channel value.

newLuminance

the new luminance value

returns

the new Color

function changeSaturation(newSaturation:Float): Color

Create a new Color with just change saturation channel value.

newSaturation

the new saturation value

returns

the new Color

function clone(): Color

Clone a Color, most time you dont need to call this because Color is un-mutable class, but to avoid UIResource, you can call this.

function darker(?factor:Float): Color

Creates a new Color that is a darker version of this Color. @see #brighter()

factor

the darker factor(0, 1), default is 0.7

returns

a new Color object that is a darker version of this Color.

function equals(o:Dynamic): Bool

Compare if compareTo object has the same value as this Color object does

compareTo

the object to compare with

returns

a Boolean value that indicates if the compareTo object's value is the same as this one

function getARGB(): Int

Returns the ARGB value representing the color.

function getBlue(): Int

Returns the blue component in the range 0-255.

returns

the blue component.

function getGreen(): Int

Returns the green component in the range 0-255.

returns

the green component.

function getHue(): Float

Returns the hue component in the range [0, 1].

returns

the hue component.

function getLuminance(): Float

Returns the luminance component in the range [0, 1].

returns

the luminance component.

function getRed(): Int

Returns the red component in the range 0-255.

returns

the red component.

function getSaturation(): Float

Returns the saturation component in the range [0, 1].

returns

the saturation component.

function offsetHLS(hOffset:Float, lOffset:Float, sOffset:Float): Color

Create a new Color with just offset the hue luminace and saturation channel values.

hOffset

offset for hue

lOffset

offset for luminance

sOffset

offset for saturation

returns

the new Color offseted

function scaleHLS(hScale:Float, lScale:Float, sScale:Float): Color

Create a new Color with just scale the hue luminace and saturation channel values.

hScale

scale for hue

lScale

scale for luminance

sScale

scale for saturation

returns

the new Color scaled

function toString(): String

function toSvg(): String