Skip to content

Color

Inherits: Class

Methods

ColorText

lua
function Color:ColorText(text)
  -> string

Colors a text string with the color.

Parameters:

NameTypeDescription
textstring | numberThe text string to color

Returns:

TypeDescription
string

GetFractionalRGBA

lua
function Color:GetFractionalRGBA()
  -> number, number, number, number

Gets the RGBA values of the color as values from 0 to 1.

Returns:

NameTypeDescription
rnumber
gnumber
bnumber
anumber

GetHex

lua
function Color:GetHex()
  -> string

Gets the hex string representation of the color.

Returns:

TypeDescription
string

GetHexNoAlpha

lua
function Color:GetHexNoAlpha()
  -> string

Gets the hex string representation of the color without the alpha channel.

Returns:

TypeDescription
string

GetOpacity

lua
function Color:GetOpacity(opacityPct)
  -> self

Gets a version of the color with a different opacity.

Parameters:

NameTypeDescription
opacityPctnumberThe opacity percentage

Returns:

TypeDescription
self

GetRGBA

lua
function Color:GetRGBA()
  -> number, number, number, number

Gets the RGBA values of the color as values from 0 to 255.

Returns:

NameTypeDescription
rnumber
gnumber
bnumber
anumber

GetTextColorPrefix

lua
function Color:GetTextColorPrefix()
  -> string

Gets the prefix used to color a text string.

Returns:

TypeDescription
string

GetTint

lua
function Color:GetTint(tintPct)
  -> self

Gets a tinted version of the color.

Parameters:

NameTypeDescription
tintPctnumberThe tint percent

Returns:

TypeDescription
self

IsLight

lua
function Color:IsLight()
  -> boolean

Returns whether or not the color is considered light.

Returns:

TypeDescription
boolean

SetRGBA

lua
function Color:SetRGBA(r, g, b, a)

Sets the RGBA values of the color as values from 0 to 255.

Parameters:

NameTypeDescription
rnumber
gnumber
bnumber
anumber

__equals

lua
function Color:__equals(other)

Parameters:

NameTypeDescription
other``

__init

lua
function Color:__init(r, g, b, a)

Parameters:

NameTypeDescription
r``
g``
b``
a``

__tostring

lua
function Color:__tostring()

Functions

HexToRGBA

lua
function Color.HexToRGBA(hex)
  -> number, number, number, number

Converts a hex string into an RGB value.

Parameters:

NameTypeDescription
hexstringThe hex string

Returns:

NameTypeDescription
rnumber
gnumber
bnumber
anumber

IsColorValue

lua
function Color.IsColorValue(arg)
  -> boolean

Returns whether or not the argument is a color value object.

Parameters:

NameTypeDescription
arganyThe argument to check

Returns:

TypeDescription
boolean

IsValidHexRGB

lua
function Color.IsValidHexRGB(str)
  -> boolean

Returns whether or not the passed string is a valid hex RGB string.

Parameters:

NameTypeDescription
strstringThe value to check

Returns:

TypeDescription
boolean

NewFromHex

lua
function Color.NewFromHex(hex)
  -> Color

Create a new color value object from a hex string.

Parameters:

NameTypeDescription
hexstringThe hex string which represents the color (in either "#AARRGGBB" or "#RRGGBB" format)

Returns:

TypeDescription
Color