lia.color
Helper library for managing colors.
Functions
Blend(color1, color2, ratio)
Blends two colors together by a specified ratio.
Parameters
-
color1
Color
The First Color.
-
color2
Color
The Second Color.
-
ratio
Float
The blend ratio ( 0.0 to 1.0 ).
Returns
-
any
color The resulting blended color.
ColorCycle(col1, col2, freq)
Returns a color that smoothly transitions between two given colors.
Parameters
-
col1
Color
The first color
-
col2
Color
The second color
-
freq
number
The frequency of the color transition
Returns
-
any
color The color resulting from the transition
ColorToHex(color)
Converts a color to a hexadecimal string.
Parameters
-
color
Color
The color to convert
Returns
-
any
string The hexadecimal color code
Darken(color, amount)
Darkens a color by the specified amount.
Parameters
-
color
Color
Color: The color to darken.
-
amount
Integer
number: The amount by which to darken the color.
Returns
-
any
color The resulting darkened color.
LerpColor(frac, from, to)
Linearly interpolates between two colors.
Parameters
-
frac
Integer
A fraction between 0 and 1 representing the interpolation amount.
-
from
Table
The starting color (a table with r, g, b, and a fields).
-
to
Table
The target color (a table with r, g, b, and a fields).
Returns
-
any
Color The resulting interpolated color.
LerpHSV(start_color, end_color, maxValue, currentValue, minValue)
Interpolates between two colors in the HSV color space.
Parameters
-
start_color
Color
The starting color.
-
end_color
Color
The ending color.
-
maxValue
Integer
The maximum value to interpolate between (used for normalization).
-
currentValue
Integer
The current value to interpolate (used for normalization).
-
minValue
Integer
optional
The minimum value to interpolate between (used for normalization). Defaults to 0.
Returns
-
any
color The resulting interpolated color.
Lighten(color, amount)
Lightens a color by the specified amount.
Parameters
-
color
Color
The color to lighten.
-
amount
Integer
The amount by which to lighten the color.
Returns
-
any
color The resulting lightened color.
Rainbow(frequency)
Returns a color that cycles through the hues of the HSV color spectrum.
Parameters
-
frequency
number
The speed at which the color cycles through hues
Returns
-
any
color The color object with the current hue
register(name, color, force)
Registers a custom color with a specified name.
Parameters
-
name
String
The name of the color to register.
-
color
Color
The color value to register.
-
force
Boolean
If true, forces registration even if the name already exists.
rgb(r, g, b)
Converts RGB values to a Color object.
Parameters
-
r
Integer
The red component (0-255).
-
g
Integer
The green component (0-255).
-
b
Integer
The blue component (0-255).
Returns
-
any
color The resulting color.
toText(color)
Converts a color object to a string representation.
Parameters
-
color
Color
The color object to convert
Returns
-
any
A string representation of the color in the format "r,g,b,a"