AddColorPicker

Adds color picker to group box | ERROR: Some SetValue colors don't work, fixing later.

Syntax

Groupbox:AddColorPicker({
    Index = "unique tool index",
    Default = {r,g,b},
    Name = "Name"
})

Both the Index and Default parameters are optional. Although, if Index is left out, you need to have a unique name. Default color is {0,0,0} (black)

  • <string> Index - Allows for duplicate names. Must be unique.

  • <string> Name - Name of color picker.

  • <RGB table> Default - The color that will be used as default.

Color Picker Functions

ColorPicker:OnChanged(function(color) -- If color value changed
    print(color)
end)

ColorPicker:SetValue({r,g,b})
ColorPicker:Show()
ColorPicker:Hide()
ColorPicker:AddTooltip("Tooltip Text")

Notes

  • Only one popup (color picker or dropdown) can be open at a time.

  • You can check which popup is active by using the Window.OpenTool variable

Example

Code shown below is missing some critical syntax for simplicity

local ColorPicker = Groupbox:AddColorPicker({Index = "picker_1", Default = {255,255,255}, Name = "GUI Color"})

--// If color picker's color changes
ColorPicker:OnChanged(function(color)
    Window.AccentColor = color
end)

--// Reset Color
Groupbox:AddButton("Reset Color", function()
    ColorPicker:SetValue({255,255,255})
end)
Color Picker Demo

Last updated