Color object

Just a color.

Color values are constructed by the global function color():
color (r: int, g: int, b: int [, opacity: int | float]) : color

The color function constructs color value from red, green, blue and opacity components.

Constants
N/A
Properties
r read-only, integer 0..255, red channel.
g read-only, integer 0..255, green channel.
b read-only, integer 0..255, blue channel.
a read-only, integer 0..255, alpha value.
opacity read-only, float 0.0 .. 1.0, that is alpha value expressed as a float.
Methods
rgba

(r: int, g: int, b: int [, opacity: int | float]) : color

Static method (of the class),  constructs color value from red, green, blue and opacity components.

hsv

(hue: float, saturation: float, value: float [, opacity: int | float]) : color

Static method (of the class),  constructs the color from HSV values, see: http://en.wikipedia.org/wiki/HSL_color_space

hsl

(hue: float, saturation: float, lightness: float [, opacity: int | float]) : color

Static method (of the class),  constructs the color from HSL values, see: http://en.wikipedia.org/wiki/HSL_color_space

parse

( text: string )

Static method (of the class),  parses the string and constructs the color value. Supported formats:

  • "#RGB"
  • "#RRGGBB"
  • "rgb(r,g,b)"
  • "rgba(r,g,b,a)"
  • literal color names like: "yellow", "gold", "red", etc.
toString

( [#RGB | #rgb | #rgba] ) : string

Returns string representation of the color value according to the format provided by the symbol defining one of formats:

  • #RGB - outputs color as "#RRGGBB";
  • #rgb - outputs color as "rgb(r,g,b)" string;
  • #rgba - as "rgba(r,g,b,a)" string.
toInteger

( ) : int

Converts the color to 32bit integer.

toHSV

( ) : array[3] of floats

Returns array[3] of floats with HSV components.

toHSL

( ) : array[3] of floats

Returns array[3] of floats with HSL components.