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.
Luau
ImGuiWindow:ColorPicker(
label: string,
red: number?,
green: number?,
blue: number?,
alpha: number?,
callback: (number, number, number, number) -> ()
) -> ImGuiWindowParameters
Call this method with a ImGuiWindow receiver. The colon supplies self implicitly; a dot call must pass the receiver explicitly.
| Parameter | Type | Description |
|---|---|---|
label | string | Color picker label. |
red | number? | Initial red component from 0 to 1. Defaults to 1. |
green | number? | Initial green component from 0 to 1. Defaults to 1. |
blue | number? | Initial blue component from 0 to 1. Defaults to 1. |
alpha | number? | 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
ImGuiWindowThe 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
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)