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.
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 label. |
red | number? | Starting red component from 0 to 1; defaults to 1. |
green | number? | Starting green component from 0 to 1; defaults to 1. |
blue | number? | Starting blue component from 0 to 1; defaults to 1. |
alpha | number? | 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
ImGuiWindowThe 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
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)