An RGB color
Name | Return Type | Description |
---|---|---|
black | Color Read-only | The color black |
blue | Color Read-only | The color blue |
cyan | Color Read-only | The color cyan |
gray | Color Read-only | The color gray |
green | Color Read-only | The color green |
grey | Color Read-only | The color grey |
magenta | Color Read-only | The color magenta |
red | Color Read-only | The color red |
white | Color Read-only | The color white |
yellow | Color Read-only | The color yellow |
Name | Return Type | Description |
---|---|---|
this[index] | number Read/Write | The color component at the specified index |
r | number Read-only | The red component |
g | number Read-only | The green component |
b | number Read-only | The blue component |
a | number Read-only | The alpha component |
grayscale | number Read-only | The grayscale value |
gamma | Color Read-only | The gamma color space representation |
linear | Color Read-only | The linear color space representation |
maxColorComponent | number Read-only | The maximum color component value |
html | string Read-only | The HTML hex string of the color (for example "A4D0FF") |
greyscale | number Read-only | The grayscale value |
hsv | Vector3 Read-only | The hue, saturation and brightess |
Creates a new instance of a color with the specified RGB values
Returns: Color (instance of the Color)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
r | number | 0 | The red component of the color. Default is 0 |
g | number | 0 | The green component of the color. Default is 0 |
b | number | 0 | The blue component of the color. Default is 0 |
myColor = Color:New(0.5, 0, 1)
Creates a new instance of the Color with the color parsed from the specified HTML string
Returns: Color (Returns the color. Invalid html inputs return bright magenta (r=1, g=0, b=1))
Parameters:
Name | Type | Default | Description |
---|---|---|---|
html | string | The HTML string representing the color |
myColor = Color:New("D3B322")
Performs a linear interpolation between two colors
Returns: Color (The interpolated color)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
a | Color | The start color | |
b | Color | The end color | |
t | number | The interpolation value. Should be between 0 and 1 |
newColor = Color:Lerp(color1, color2, 0.5)
Performs a linear interpolation between two colors without clamping the interpolation parameter
Returns: Color (color)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
a | Color | The start color | |
b | Color | The end color | |
t | number | The interpolation value |
newColor = Color:Lerp(color1, color2, 1.5)
Converts an HSV color to an RGB color
Returns: Color (color)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
h | number | The hue value. Should be between 0 and 1 | |
s | number | The saturation value. Should be between 0 and 1 | |
v | number | The value value. Should be between 0 and 1 |
newColor = Color:HsvToRgb(0.5, 0.9, 0.5)
Converts an HSV Vector3 to an RGB color
Returns: Color (color)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
hsv | Vector3 | A Vector3 with xyz representing hsv. All values between 0 and 1 |
newColor = Color:HsvToRgb(myHsv)
Adds the specified color to this color
Returns: Color (color)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
other | Color | The color to add |
newColor = color1:Add(color2)
Adds the specified RGB values to this color
Returns: Color (color)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
r | number | The red component value to add | |
g | number | The green component value to add | |
b | number | The blue component value to add |
newColor = color1:Add(0.5, 0, 0.1)
Subtracts the specified color from this color
Returns: Color (color)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
other | Color | The color to subtract |
newColor = color1:Subtract(color2)
Subtracts the specified RGB values from this color
Returns: Color (color)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
r | number | The red component value to subtract | |
g | number | The green component value to subtract | |
b | number | The blue component value to subtract |
newColor = color1:Subtract(0.5, 0.25, 0)
Multiplies this color by the specified value
Returns: Color (color)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
value | number | The value to multiply |
newColor = color1:Multiply(0.5)
Multiplies this color by the specified RGB values
Returns: Color (color)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
r | number | The red component value to multiply | |
g | number | The green component value to multiply | |
b | number | The blue component value to multiply |
newColor = color1:Multiply(0.85, 0, 0)
Divides this color by the specified value
Returns: Color (color)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
value | number | The value to divide |
newColor = color1:Divide(0.5)
Determines whether this color is not equal to the specified color
Returns: boolean (true if this color is not equal to the specified color; otherwise, false)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
other | Color | The color to compare |
if color1:NotEquals(color2) then print("colors are different") end
Determines whether this color is not equal to the specified RGB values
Returns: boolean (true if this color is not equal to the specified RGB values; otherwise, false)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
r | number | The red component value to compare | |
g | number | The green component value to compare | |
b | number | The blue component value to compare |
if color1:NotEquals(0, 1, 0) then print("color is not green") end