Color Picker
Color pickers let users choose colors (optionally with transparency) from a toggle or label reference.
Playground
This is a toggle
Values must be between 0 and 1.
Allow transparency selection
Usage
You can create a Color Picker by calling the AddColorPicker method on a toggle or label reference.
Arguments
local Toggle = Groupbox:AddToggle("MyToggle", {
Text = "This is a toggle",
Default = true,
})
local ColorPicker = Toggle:AddColorPicker("ColorPicker1", {
Default = Color3.new(1, 0, 0),
Title = "Some color",
})| Arg Idx | Argument Description | Type | Default |
|---|---|---|---|
| 1 | Index/ID of the color picker | string | nil |
| 2 | Color picker configuration table | table | nil |
Configuration Table
Prop
Type
Methods
You can use the following methods to interact with the color picker:
SetValue
Sets the color using HSV components.
ColorPicker:SetValue(hsv, transparency)| Arg Idx | Argument Description | Type | Default |
|---|---|---|---|
| 1 | HSV table (e.g. {H = 0, S = 1, V = 1}) | table | nil |
| 2 | Transparency between 0 and 1 | number | nil |
SetValueRGB
Sets the color using an RGB Color3 value.
ColorPicker:SetValueRGB(color, transparency)| Arg Idx | Argument Description | Type | Default |
|---|---|---|---|
| 1 | RGB color (Color3) | Color3 | nil |
| 2 | Transparency between 0 and 1 | number | nil |
OnChanged
Registers an additional change callback.
ColorPicker:OnChanged(function)| Arg Idx | Argument Description | Type | Default |
|---|---|---|---|
| 1 | Callback executed when the color changes | function | nil |
Example
local Options = Library.Options
local Toggle = Groupbox:AddToggle("MyToggle", {
Text = "This is a toggle",
Default = true,
})
local ColorPicker = Toggle:AddColorPicker("ColorPicker1", {
Default = Color3.new(1, 0, 0),
Title = "Some color",
Transparency = 0,
})
Options.ColorPicker1:OnChanged(function()
print("Color changed!", Options.ColorPicker1.Value)
if Options.ColorPicker1.Transparency then
print("Transparency changed!", Options.ColorPicker1.Transparency)
end
end)
Options.ColorPicker1:SetValueRGB(Color3.fromRGB(0, 255, 140))Color pickers can also be attached to labels via AddLabel(...):AddColorPicker(...) for static UI configuration.