Skip to content

niColor⚓︎

An object that represents a RGB color. The values are in [0.0, 1.0] range.

Properties⚓︎

b⚓︎

The blue value of the color.

Returns:

  • result (number)

blue⚓︎

Alias for the blue value of the color.

Returns:

  • result (number)

g⚓︎

The green value of the color.

Returns:

  • result (number)

green⚓︎

Alias for the green value of the color.

Returns:

  • result (number)

r⚓︎

The red value of the color.

Returns:

  • result (number)

red⚓︎

Alias for the red value of the color.

Returns:

  • result (number)

Methods⚓︎

clamp⚓︎

Clamps the color object to [0.0, 1.0] range.

myObject:clamp()

copy⚓︎

Creates a copy of the color object.

local result = myObject:copy()

Returns:


lerp⚓︎

Calculates the interpolated color between this color and another, given a transition.

local lerpedcolor = myObject:lerp(tocolor, transition)

Parameters:

  • tocolor (niColor): The color to interpolate towards.
  • transition (number): The interpolation value. Must be between 0.0 (closer to this color) and 1.0 (closer to the other color).

Returns:

  • lerpedcolor (niColor): The calculated value.

toVector3⚓︎

Creates a vector3 of the color object.

local result = myObject:toVector3()

Returns:


Functions⚓︎

new⚓︎

Creates a new niColor.

local color = niColor.new(r, g, b)

Parameters:

  • r (number): Default: 0. The red value for the color.
  • g (number): Default: 0. The green value for the color.
  • b (number): Default: 0. The blue value for the color.

Returns:


Math Operations⚓︎

Addition (+)⚓︎

Left operand type Right operand type Result type Description
niColor niColor niColor Adds the color channel values of two niColor objects.

Multiplication (*)⚓︎

Left operand type Right operand type Result type Description
niColor niColor niColor Multiplies color channel values.
niColor number niColor Multiplies each color value with a scalar.

Subtraction (-)⚓︎

Left operand type Right operand type Result type Description
niColor niColor niColor Subtracts the color channel values.