ImGuiWindow:ColorPicker Asynchronous

Add four numeric inputs for red, green, blue, and alpha. Use the callback to keep all four parts of a color setting together.

Syntax
Luau
ImGuiWindow:ColorPicker(
    label: string,
    red: number?,
    green: number?,
    blue: number?,
    alpha: number?,
    callback: (number, number, number, number) -> ()
) -> ImGuiWindow

Parameters

Call this method with a ImGuiWindow receiver. The colon supplies self implicitly; a dot call must pass the receiver explicitly.

Function parameters
ParameterTypeDescription
labelstringColor label.
rednumber?Starting red component from 0 to 1; defaults to 1.
greennumber?Starting green component from 0 to 1; defaults to 1.
bluenumber?Starting blue component from 0 to 1; defaults to 1.
alphanumber?Starting alpha component from 0 to 1; defaults to 1.
callback(number, number, number, number) -> ()Function receiving red, green, blue, and alpha in that order.

Returns

ImGuiWindow

The same ImGuiWindow handle, so more controls can be added with another method call.

Usage notes

The callback runs when the user interacts with the control. Its return value is ignored.

Kawaii displays four numeric fields rather than a color wheel. Edited components are clamped to 0 through 1.

Example

Example
Luau
local window = imgui.create("Example controls")
window:ColorPicker("Accent", 1, 0.5, 0.75, 1, function(r, g, b, a)
    print("Accent:", r, g, b, "alpha:", a)
end)
Kawaii documentation