ImGuiWindow:ColorPicker Asynchronous

Add controls for editing an initial RGBA color. Use it to let the user edit a color and its alpha together. Store all four callback values when the setting needs to be saved.

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 picker label.
rednumber?Initial red component from 0 to 1. Defaults to 1.
greennumber?Initial green component from 0 to 1. Defaults to 1.
bluenumber?Initial blue component from 0 to 1. Defaults to 1.
alphanumber?Initial alpha component from 0 to 1. Defaults to 1.
callback(number, number, number, number) -> ()Receives red, green, blue, and alpha as four numbers when a component is submitted.

Returns

ImGuiWindow

The same ImGuiWindow, allowing another window method to be chained.

Usage notes

Interaction callbacks run when the control is used. Their return values are discarded.

Kawaii displays four numeric fields for R, G, B, and A. Values are clamped to the range 0–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