> For the complete documentation index, see [llms.txt](https://idontgiveaf.gitbook.io/fluent/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://idontgiveaf.gitbook.io/fluent/elements/guide/colorpickers.md).

# Colorpickers

To create a colorpicker, use this.

```lua
local Colorpicker = Tabs.Main:AddColorpicker("Colorpicker", {
    Title = "Colorpicker",
    Description = "Description for colorpicker",
    Default = Color3.fromRGB(96, 205, 255),
    -- (Optional) Transparency = 0,
    Callback = function(color)
        print("Colorpicker was changed:", color)
    end
})
```

{% hint style="warning" %}
If you are having issues, you're supposed to replace "Tabs.Main" with your actual tab.&#x20;

Example: "Tabs.Exploits"&#x20;

Whatever you put in your [Tabs](/fluent/components/window/tabs.md) variable, it's what you need.
{% endhint %}

Change `local Colorpicker` to a different variable name every time. It can be anything.

You can remove the `local Colorpicker` if you aren't gonna use it.

`Colorpicker` (name of colorpicker) is saved in the Options variable.

You can try to remove the name, but I've never tried to.

To allow users to set the transparency, just make the `Transparency = 0`.

{% hint style="danger" %}
I have no idea what it returns when it has transperency.
{% endhint %}

You can get the value anywhere simply by using this: (Put your variable name)

```lua
Colorpicker.Value
```

Or, whatever you put as the name of the toggle.

```lua
Options.Colorpicker.Value
```

### Functions

You can check when the colorpicker is changed, but Callback does the same thing.

```lua
Colorpicker:OnChanged(function()
    print("Colorpicker changed:", Colorpicker.Value)
end)
```

To check the transperency, (if you're using it)

```lua
Colorpicker:OnChanged(function()
    print(
        "TColorpicker changed:", TColorpicker.Value,
        "Transparency:", TColorpicker.Transparency
    )
end)
```

To set the value of a colorpicker, use this.

```lua
Colorpicker:SetValueRGB(Color3.fromRGB(0, 255, 140))
```

Or, if you're using transperency.

```lua
Colorpicker:SetValue({0, 100, 100}, 0.5) -- hsv, transparency
```

{% hint style="warning" %}
If you don't set the right variable name, it won't work.
{% endhint %}
