Class: Color32

rune.color.Color32(ropt, gopt, bopt, aopt)

Represents a 32-bit RGB color. A color consists of four 8-bit components; red, green, blue and alpha.

Constructor

new Color32(ropt, gopt, bopt, aopt)

Creates a new 32-bit RGB color.
Parameters:
Name Type Attributes Default Description
r number <optional>
0 The red component.
g number <optional>
0 The green component.
b number <optional>
0 The blue component.
a number <optional>
0 The alpha component.
Source:

Extends

Members

(readonly) alpha :rune.util.ColorComponent

The alpha component (in 8 bits), ie, a value between 0 and 255.
Type:
  • rune.util.ColorComponent
Source:

(readonly) blue :rune.util.ColorComponent

The blue component (in 8 bits), ie, a value between 0 and 255.
Type:
  • rune.util.ColorComponent
Inherited From:
Source:

(readonly) green :rune.util.ColorComponent

The green component (in 8 bits), ie, a value between 0 and 255.
Type:
  • rune.util.ColorComponent
Inherited From:
Source:

(readonly) red :rune.util.ColorComponent

The red component (in 8 bits), ie, a value between 0 and 255.
Type:
  • rune.util.ColorComponent
Inherited From:
Source:

Methods

dispose() → {undefined}

Disposes this color.
Overrides:
Source:
Returns:
Type
undefined

random() → {undefined}

Generates a random color for this object.
Inherited From:
Source:
Returns:
Type
undefined

setRGB(r, g, b) → {undefined}

Sets the color instance to the specified RGB value.
Parameters:
Name Type Description
r number The red component (in 8 bits), ie, a value between 0 and 255.
g number The green component (in 8 bits), ie, a value between 0 and 255.
b number The blue component (in 8 bits), ie, a value between 0 and 255.
Inherited From:
Source:
Returns:
Type
undefined

setRGBA(r, g, b, a) → {undefined}

Sets the color instance to the specified RGBA value.
Parameters:
Name Type Description
r number The red component (in 8 bits), ie, a value between 0 and 255.
g number The green component (in 8 bits), ie, a value between 0 and 255.
b number The blue component (in 8 bits), ie, a value between 0 and 255.
a number The alpha component (in 8 bits), ie, a value between 0 and 255.
Source:
Returns:
Type
undefined

toString() → {string}

Returns a 32-bit RGBA representation of this color, as a string.
Overrides:
Source:
Returns:
Type
string

(static) fromHex(s) → {rune.color.Color32}

Creates and returns a new Color32 object, based on a hexadecimal value, specified in string format.
Parameters:
Name Type Description
s string String-based color code (as hexadecimal).
Source:
Returns:
Type
rune.color.Color32