Namespace: rlColors

rlColors

Builtin, ready-to-use color definitions (all trademarks are the property of their respective owners).

Methods

(static) getPalette(name) → {rlPalette}

Get one of the built-in well-known (from oldschool hardware or from the pixelart community) palettes of Refugee Lib. valid palette names are: AA16, AMSTRADCPC, APPLEII, C64, CGA, DB16, DB32, GB, MSX, NES*, TELETEXT, TO7/70, VIC20, ZXSPECTRUM

Parameters:
Name Type Description
name string

the name of the palette to get

See:
Returns:
Type
rlPalette

(static) getPaletteNames() → {Array.<string>}

Get an array of all built-in palette names.

Returns:
Type
Array.<string>

(static) hasPalette(name) → {boolean}

Test if there is a built-in palette with the given name.

Parameters:
Name Type Description
name string

the name of the palette to test

Returns:
Type
boolean

(static) HTMLtoRGB(htmlCode) → {rlColors.rgb}

Convert an HTML color string to an rgb triplet.

Parameters:
Name Type Description
htmlCode string

the html color string to convert, e.g. "#234266"

Returns:
Type
rlColors.rgb

(static) HTMLtoYPBPR(htmlCode) → {rlColors.ypbpr}

Convert an HTML color string to a ypbpr triplet.

Parameters:
Name Type Description
htmlCode string

the html color string to convert, e.g. "#234266"

Returns:
Type
rlColors.ypbpr

(static) RGBtoHTML(rgb) → {string}

Convert an rgb triplet to an HTML color string.

Parameters:
Name Type Description
rgb rlColors.rgb

the triplet to convert, e.g. { r: 0.13, g: 0.37, b: 0.42 }

Returns:
Type
string

(static) RGBtoYPBPR(rgb) → {rlColors.ypbpr}

Convert an rgb triplet to a ypbpr triplet.

Parameters:
Name Type Description
rgb rlColors.rgb

the triplet to convert, e.g. { r: 0.10, g: 0.03, b: 0.81 }

Returns:
Type
rlColors.ypbpr

(static) YPBPRtoHTML(ypbpr) → {string}

Convert a ypbpr triplet to an HTML color string.

Parameters:
Name Type Description
ypbpr rlColors.ypbpr

the triplet to convert

Returns:
Type
string

(static) YPBPRtoRGB(ypbpr) → {rlColors.rgb}

Convert a ypbpr triplet to an rgb triplet.

Parameters:
Name Type Description
ypbpr rlColors.ypbpr

the triplet to convert

Returns:
Type
rlColors.rgb

Type Definitions

rgb

(not an actual type, use object literals with these properties)

Properties:
Name Type Description
r number

red component (0.0 to 1.0)

g number

green component (0.0 to 1.0)

b number

blue component (0.0 to 1.0)

ypbpr

(not an actual type, use object literals with these properties)

Properties:
Name Type Description
y number

luma

pb number

difference between blue and luma

pr number

difference between red and luma