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.

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.

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.