Color Class

Color Class — Represents a color.

Members

string as_string

HTML hex encoded: #rrggbb

int b

(Read-only) Blue value, 0-255.

int g

(Read-only) Green value, 0-255.

int r

(Read-only) Red value, 0-255.

Methods

Color(string s) : Color

Constructor for color class. Lets you make a Color object from a string of form #rrggbb

average(Color other) : Color

Returns color averaged with $other color.

blend(Color other, int value) : Color

Returns color blended with $other color by percentage value (int between 0 and 100).

blue() : int

Get the blue value.

blue(int b) : void

Set the blue value. (0-255)

clone() : Color

Returns identical color.

darker() : Color

Returns a new color with lightness decreased by 30.

darker(int amt) : Color

Returns a new color with lightness decreased by amount given.

green() : int

Get the green value.

green(int g) : void

Set the green value. (0-255)

hue() : int

Get the hue value. (0-255)

hue(int h) : void

Set the hue value. (0-255)

inverse() : Color

Returns inverse of color.

lighter() : Color

Returns a new color with lightness increased by 30.

lighter(int amt) : Color

Returns a new color with lightness increased by amount given.

lightness() : int

Get the lightness value. (0-255)

lightness(int v) : void

Set the lightness value. (0-255)

red() : int

Get the red value.

red(int r) : void

Set the red value. (0-255)

saturation() : int

Get the saturation value. (0-255)

saturation(int s) : void

Set the saturation value. (0-255)

set_hsl(int h, int s, int v) : void

Set the HSL value for a color class.