ColorPicker
Choose an RGB color with an HSV popup and strict hex helpers.
Create ColorPicker#
Choose an RGB color with an HSV popup and strict hex helpers.
The constructor returns a ColorPicker handle. The snippet assumes section exists, as created in Quick start.
local color = section:CreateColorPicker({
Name = "Preview color", Flag = "preview-color",
Default = Color3.fromRGB(164, 184, 169),
Callback = function(value) print(value.R, value.G, value.B) end,
})
Open full size ↗Arguments#
| Option | Type | Default | Meaning |
|---|---|---|---|
| Default | Color3 | Theme.Colors.Text | Initial RGB color. |
| Callback | function(Color3) | nil | Receives the changed color. |
Also accepts common options: Name, Description, Disabled and Callback; stateful controls additionally support Flag, Persist and Sensitive.
Manage state#
color:SetValue(Color3.fromRGB(242, 242, 240))
local _, valid = color:SetHex("#A4B8A9", true)
assert(valid)
print(color:GetHex())
color:Open()
color:Close()Returned methods#
| Method | Returns | Behavior |
|---|---|---|
| GetValue() | Color3 | Current Color3 value. |
| SetValue(value, notify?) | self | Silent by default; true calls Callback only after a changed normalized value. |
| SetDisabled(boolean) | self | Changes user availability without discarding the value. |
| IsDisabled() | boolean | Reads the requested disabled state. |
| Destroy() | nil | Removes this control and its subscriptions; safe to repeat. |
| GetHex() | string | Uppercase #RRGGBB representation. |
| SetHex(string, notify?) | self, valid:boolean | Three or six hex digits, optional #; trims outer whitespace. Invalid value leaves state unchanged. |
| Open() / Close(instant?) | self | Popup request/close, default instant=false. |
| IsOpen() | boolean | Reads logical popup state. |
Behavior and limitations#
There is no alpha channel, gradient API or live theme setter. Picking a color does not retheme an existing window automatically.
Color channels are compared with a 1e-7 tolerance. Configuration stores finite normalized RGB values in [0,1].
Shares popup arbitration with Dropdown. Mouse/touch drags cancel when input becomes unavailable; mobile rendering still requires a real device check.
Default and SetValue require Color3 with finite channels; invalid values assert. Runtime setters clamp channels to [0,1]. SetHex returns false for malformed or non-string input without changing the color; notify, when supplied, must be boolean.