reference monoe.color

Lua API Reference

represents an RGBA color (encoded on 4 bytes, RRGGBBAA)

Properties

NameTypeDescription
rintegerRed (0–255)
gintegerGreen (0–255)
bintegerBlue (0–255)
aintegerAlpha (0–255)

clamp8


monoe.color.new

Creates a new color.

Parameters

NameTypeDescription
rinteger|nil
ginteger|nil
binteger|nil
ainteger|nilAlpha (default 255)

Returns


monoe.color.gray

Creates a color from a grayscale value.

Parameters

NameTypeDescription
vinteger
ainteger|nil

Returns


monoe.color.from_hex

Creates a color from a hex integer (0xRRGGBB or 0xRRGGBBAA).

Parameters

NameTypeDescription
hexinteger

Returns


monoe.color.from_int

Creates a color from a packed RGBA32 integer.

Parameters

NameTypeDescription
valueintegerUnsigned 32-bit (0xRRGGBBAA)

Returns


monoe.color:to_int

Returns the color as a packed RGBA32 unsigned integer.

Returns


monoe.color:clone

Returns a copy of this color.

Returns


monoe.color:__tostring

Returns a string representation.


monoe.color:add

Adds another color to this one (channel-wise, clamped).

Parameters

NameTypeDescription
othermonoe.color

Returns


monoe.color.__add


monoe.color:shadow

Returns a shadow version of the color.

Parameters

NameTypeDescription
factornumberDarkening factor (0–1), default 0.5

Returns


monoe.color:luminosity

Returns perceived luminosity (0–255).

Returns


monoe.color:contrast

Returns black or white depending on contrast.

Returns


monoe.color:palette

Generates a palette from this color.

Parameters

NameTypeDescription
stepsintegerNumber of variations

Returns


monoe.color:string

Returns a Godot-friendly color string. Either "#RRGGBB" if alpha is 255, else "#RRGGBBAA"

Returns


byte_to_hex


monoe.color.from_string

Creates a color from a string. Supports "#RRGGBB", "#RRGGBBAA", "R,G,B" or "R,G,B,A"

Parameters

NameTypeDescription
strstring

Returns