local M=game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")local B=game:GetService("\084\111\117\099\104\073\110\112\117\116\083\101\114\118\105\099\101")local f=game:GetService("\082\117\110\083\101\114\118\105\099\101")local e=game:GetService("\080\108\097\121\101\114\115")local D=f.RenderStepped local A=e.LocalPlayer local n=A:GetMouse()local H=script.Parent.Parent local b=require(H.Creator)local d=b.New local z=H.Components local p={}p.__index=p p.__type="\067\111\108\111\114\112\105\099\107\101\114"function p.New(e,B,f)local A=e.Library assert(f.Title,"\067\111\108\111\114\112\105\099\107\101\114 - \077\105\115\115\105\110\103 \084\105\116\108\101")assert(f.Default,"\065\100\100\067\111\108\111\114\080\105\099\107\101\114\058 \077\105\115\115\105\110\103 \100\101\102\097\117\108\116 \118\097\108\117\101\046")local s={Value=f.Default;Transparency=f.Transparency or 0;Type="\067\111\108\111\114\112\105\099\107\101\114";Title=type(f.Title)=="\115\116\114\105\110\103"and f.Title or"\067\111\108\111\114\112\105\099\107\101\114",Callback=f.Callback or function(M) end}function s.SetHSVFromRGB(B,M)local f,e,D=Color3.toHSV(M)s.Hue=f s.Sat=e s.Vib=D end s:SetHSVFromRGB(s.Value)local C=(require(z.Element))(f.Title,f.Description,e.Container,true)s.SetTitle=C.SetTitle s.SetDesc=C.SetDesc local R=d("\070\114\097\109\101",{Size=UDim2.fromScale(1,1);BackgroundColor3=s.Value;Parent=C.Frame},{d("\085\073\067\111\114\110\101\114",{CornerRadius=UDim.new(0,4)})})local U=d("\073\109\097\103\101\076\097\098\101\108",{Size=UDim2.fromOffset(26,26);Position=UDim2.new(1,-10,.5,0),AnchorPoint=Vector2.new(1,.5),Parent=C.Frame;Image="\104\116\116\112\058\047\047\119\119\119\046\114\111\098\108\111\120\046\099\111\109\047\097\115\115\101\116\047\063\105\100\061\049\052\050\048\052\050\051\049\053\050\050";ImageTransparency=.45;ScaleType=Enum.ScaleType.Tile;TileSize=UDim2.fromOffset(40,40)},{d("\085\073\067\111\114\110\101\114",{CornerRadius=UDim.new(0,4)});R})local function J()local B=(require(z.Dialog)):Create()B.Title.Text=s.Title B.Root.Size=UDim2.fromOffset(430,330)local e,A,p=s.Hue,s.Sat,s.Vib local C=s.Transparency local function R()local M=(require(z.Textbox))()M.Frame.Parent=B.Root M.Frame.Size=UDim2.new(0,90,0,32)return M end local function U(M,f)return d("\084\101\120\116\076\097\098\101\108",{FontFace=Font.new("\114\098\120\097\115\115\101\116\058\047\047\102\111\110\116\115\047\102\097\109\105\108\105\101\115\047\071\111\116\104\097\109\083\083\109\046\106\115\111\110",Enum.FontWeight.Medium,Enum.FontStyle.Normal);Text=M;TextColor3=Color3.fromRGB(240,240,240);TextSize=13,TextXAlignment=Enum.TextXAlignment.Left;Size=UDim2.new(1,0,0,32),Position=f,BackgroundTransparency=1,Parent=B.Root;ThemeTag={TextColor3="\084\101\120\116"}})end local function J()local M=Color3.fromHSV(e,A,p)return{R=math.floor(M.r*255),G=math.floor(M.g*255);B=math.floor(M.b*255)}end local o=d("\073\109\097\103\101\076\097\098\101\108",{Size=UDim2.new(0,18,0,18);ScaleType=Enum.ScaleType.Fit;AnchorPoint=Vector2.new(.5,.5),BackgroundTransparency=1,Image="\104\116\116\112\058\047\047\119\119\119\046\114\111\098\108\111\120\046\099\111\109\047\097\115\115\101\116\047\063\105\100\061\052\056\048\053\054\051\057\048\048\048"})local j=d("\073\109\097\103\101\076\097\098\101\108",{Size=UDim2.fromOffset(180,160);Position=UDim2.fromOffset(20,55);Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\052\049\053\053\056\048\049\050\053\050",BackgroundColor3=s.Value;BackgroundTransparency=0;Parent=B.Root},{d("\085\073\067\111\114\110\101\114",{CornerRadius=UDim.new(0,4)}),o})local v=d("\070\114\097\109\101",{BackgroundColor3=s.Value;Size=UDim2.fromScale(1,1);BackgroundTransparency=s.Transparency},{d("\085\073\067\111\114\110\101\114",{CornerRadius=UDim.new(0,4)})})local I=d("\073\109\097\103\101\076\097\098\101\108",{Image="\104\116\116\112\058\047\047\119\119\119\046\114\111\098\108\111\120\046\099\111\109\047\097\115\115\101\116\047\063\105\100\061\049\052\050\048\052\050\051\049\053\050\050";ImageTransparency=.45;ScaleType=Enum.ScaleType.Tile,TileSize=UDim2.fromOffset(40,40);BackgroundTransparency=1;Position=UDim2.fromOffset(112,220);Size=UDim2.fromOffset(88,24),Parent=B.Root},{d("\085\073\067\111\114\110\101\114",{CornerRadius=UDim.new(0,4)});d("\085\073\083\116\114\111\107\101",{Thickness=2,Transparency=.75}),v})local w=d("\070\114\097\109\101",{BackgroundColor3=s.Value,Size=UDim2.fromScale(1,1);BackgroundTransparency=0},{d("\085\073\067\111\114\110\101\114",{CornerRadius=UDim.new(0,4)})})local q=d("\073\109\097\103\101\076\097\098\101\108",{Image="\104\116\116\112\058\047\047\119\119\119\046\114\111\098\108\111\120\046\099\111\109\047\097\115\115\101\116\047\063\105\100\061\049\052\050\048\052\050\051\049\053\050\050";ImageTransparency=.45,ScaleType=Enum.ScaleType.Tile;TileSize=UDim2.fromOffset(40,40),BackgroundTransparency=1;Position=UDim2.fromOffset(20,220),Size=UDim2.fromOffset(88,24),Parent=B.Root},{d("\085\073\067\111\114\110\101\114",{CornerRadius=UDim.new(0,4)}),d("\085\073\083\116\114\111\107\101",{Thickness=2,Transparency=.75}),w})local V={}for M=0,1,.1 do table.insert(V,ColorSequenceKeypoint.new(M,Color3.fromHSV(M,1,1)))end local S=d("\085\073\071\114\097\100\105\101\110\116",{Color=ColorSequence.new(V);Rotation=90})local G=d("\070\114\097\109\101",{Size=UDim2.new(1,0,1,-10),Position=UDim2.fromOffset(0,5);BackgroundTransparency=1})local t=d("\073\109\097\103\101\076\097\098\101\108",{Size=UDim2.fromOffset(14,14),Image="\104\116\116\112\058\047\047\119\119\119\046\114\111\098\108\111\120\046\099\111\109\047\097\115\115\101\116\047\063\105\100\061\049\050\050\054\054\057\052\054\049\050\056";Parent=G,ThemeTag={ImageColor3="\068\105\097\108\111\103\073\110\112\117\116"}})local u=d("\070\114\097\109\101",{Size=UDim2.fromOffset(12,190);Position=UDim2.fromOffset(210,55),Parent=B.Root},{d("\085\073\067\111\114\110\101\114",{CornerRadius=UDim.new(1,0)}),S;G})local O=R()O.Frame.Position=UDim2.fromOffset(f.Transparency and 260 or 240,55)U("\072\101\120",UDim2.fromOffset(f.Transparency and 360 or 340,55))local T=R()T.Frame.Position=UDim2.fromOffset(f.Transparency and 260 or 240,95)U("\082\101\100",UDim2.fromOffset(f.Transparency and 360 or 340,95))local k=R()k.Frame.Position=UDim2.fromOffset(f.Transparency and 260 or 240,135)U("\071\114\101\101\110",UDim2.fromOffset(f.Transparency and 360 or 340,135))local m=R()m.Frame.Position=UDim2.fromOffset(f.Transparency and 260 or 240,175)U("\066\108\117\101",UDim2.fromOffset(f.Transparency and 360 or 340,175))local N if f.Transparency then N=R()N.Frame.Position=UDim2.fromOffset(260,215)U("\065\108\112\104\097",UDim2.fromOffset(360,215))end local c,Y,X if f.Transparency then local M=d("\070\114\097\109\101",{Size=UDim2.new(1,0,1,-10);Position=UDim2.fromOffset(0,5);BackgroundTransparency=1})Y=d("\073\109\097\103\101\076\097\098\101\108",{Size=UDim2.fromOffset(14,14),Image="\104\116\116\112\058\047\047\119\119\119\046\114\111\098\108\111\120\046\099\111\109\047\097\115\115\101\116\047\063\105\100\061\049\050\050\054\054\057\052\054\049\050\056";Parent=M;ThemeTag={ImageColor3="\068\105\097\108\111\103\073\110\112\117\116"}})X=d("\070\114\097\109\101",{Size=UDim2.fromScale(1,1)},{d("\085\073\071\114\097\100\105\101\110\116",{Transparency=NumberSequence.new({NumberSequenceKeypoint.new(0,0),NumberSequenceKeypoint.new(1,1)});Rotation=270}),d("\085\073\067\111\114\110\101\114",{CornerRadius=UDim.new(1,0)})})c=d("\070\114\097\109\101",{Size=UDim2.fromOffset(12,190);Position=UDim2.fromOffset(230,55);Parent=B.Root;BackgroundTransparency=1},{d("\085\073\067\111\114\110\101\114",{CornerRadius=UDim.new(1,0)}),d("\073\109\097\103\101\076\097\098\101\108",{Image="\104\116\116\112\058\047\047\119\119\119\046\114\111\098\108\111\120\046\099\111\109\047\097\115\115\101\116\047\063\105\100\061\049\052\050\048\052\050\051\049\053\050\050";ImageTransparency=.45;ScaleType=Enum.ScaleType.Tile,TileSize=UDim2.fromOffset(40,40),BackgroundTransparency=1,Size=UDim2.fromScale(1,1),Parent=B.Root},{d("\085\073\067\111\114\110\101\114",{CornerRadius=UDim.new(1,0)})}),X;M})end local function a()j.BackgroundColor3=Color3.fromHSV(e,1,1)t.Position=UDim2.new(0,-1,e,-6)o.Position=UDim2.new(A,0,1-p,0)w.BackgroundColor3=Color3.fromHSV(e,A,p)O.Input.Text="\035"..(Color3.fromHSV(e,A,p)):ToHex()T.Input.Text=(J()).R k.Input.Text=(J()).G m.Input.Text=(J()).B if f.Transparency then X.BackgroundColor3=Color3.fromHSV(e,A,p)w.BackgroundTransparency=C Y.Position=UDim2.new(0,-1,1-C,-6)N.Input.Text=(require(H)):Round((1-C)*100,0).."\037"end end b.AddSignal(O.Input.FocusLost,function(M)if M then local M,B=pcall(Color3.fromHex,O.Input.Text)if M and typeof(B)=="\067\111\108\111\114\051"then e,A,p=Color3.toHSV(B)end end a()end)b.AddSignal(T.Input.FocusLost,function(M)if M then local M=J()local B,f=pcall(Color3.fromRGB,T.Input.Text,M.G,M.B)if B and typeof(f)=="\067\111\108\111\114\051"then if tonumber(T.Input.Text)<=255 then e,A,p=Color3.toHSV(f)end end end a()end)b.AddSignal(k.Input.FocusLost,function(M)if M then local M=J()local B,f=pcall(Color3.fromRGB,M.R,k.Input.Text,M.B)if B and typeof(f)=="\067\111\108\111\114\051"then if tonumber(k.Input.Text)<=255 then e,A,p=Color3.toHSV(f)end end end a()end)b.AddSignal(m.Input.FocusLost,function(M)if M then local M=J()local B,f=pcall(Color3.fromRGB,M.R,M.G,m.Input.Text)if B and typeof(f)=="\067\111\108\111\114\051"then if tonumber(m.Input.Text)<=255 then e,A,p=Color3.toHSV(f)end end end a()end)if f.Transparency then b.AddSignal(N.Input.FocusLost,function(M)if M then pcall(function()local M=tonumber(N.Input.Text)if M>=0 and M<=100 then C=1-M*.01 end end)end a()end)end b.AddSignal(j.InputBegan,function(B)if B.UserInputType==Enum.UserInputType.MouseButton1 or B.UserInputType==Enum.UserInputType.Touch then while M:IsMouseButtonPressed(Enum.UserInputType.MouseButton1)do local M=j.AbsolutePosition.X local B=M+j.AbsoluteSize.X local f=math.clamp(n.X,M,B)local e=j.AbsolutePosition.Y local H=e+j.AbsoluteSize.Y local b=math.clamp(n.Y,e,H)A=(f-M)/(B-M)p=1-(b-e)/(H-e)a()D:Wait()end end end)b.AddSignal(u.InputBegan,function(B)if B.UserInputType==Enum.UserInputType.MouseButton1 or B.UserInputType==Enum.UserInputType.Touch then while M:IsMouseButtonPressed(Enum.UserInputType.MouseButton1)do local M=u.AbsolutePosition.Y local B=M+u.AbsoluteSize.Y local f=math.clamp(n.Y,M,B)e=(f-M)/(B-M)a()D:Wait()end end end)if f.Transparency then b.AddSignal(c.InputBegan,function(B)if B.UserInputType==Enum.UserInputType.MouseButton1 then while M:IsMouseButtonPressed(Enum.UserInputType.MouseButton1)do local M=c.AbsolutePosition.Y local B=M+c.AbsoluteSize.Y local f=math.clamp(n.Y,M,B)C=1-(f-M)/(B-M)a()D:Wait()end end end)end a()B:Button("\068\111\110\101",function()s:SetValue({e,A;p},C)end)B:Button("\067\097\110\099\101\108")B:Open()end function s.Display(M)s.Value=Color3.fromHSV(s.Hue,s.Sat,s.Vib)R.BackgroundColor3=s.Value R.BackgroundTransparency=s.Transparency p.Library:SafeCallback(s.Callback,s.Value)p.Library:SafeCallback(s.Changed,s.Value)end function s.SetValue(f,M,B)local e=Color3.fromHSV(M[1],M[2],M[3])s.Transparency=B or 0 s:SetHSVFromRGB(e)s:Display()end function s.SetValueRGB(f,M,B)s.Transparency=B or 0 s:SetHSVFromRGB(M)s:Display()end function s.OnChanged(B,M)s.Changed=M M(s.Value)end function s.Destroy(M)C:Destroy()A.Options[B]=nil end b.AddSignal(C.Frame.MouseButton1Click,function()J()end)s:Display()A.Options[B]=s return s end return p
local UserInputService = game:GetService("UserInputService")
local TouchInputService = game:GetService("TouchInputService")
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")

local RenderStepped = RunService.RenderStepped
local LocalPlayer = Players.LocalPlayer
local Mouse = LocalPlayer:GetMouse()

local Root = script.Parent.Parent
local Creator = require(Root.Creator)

local New = Creator.New
local Components = Root.Components

local Element = {}
Element.__index = Element
Element.__type = "Colorpicker"

function Element:New(Idx, Config)
	local Library = self.Library
	assert(Config.Title, "Colorpicker - Missing Title")
	assert(Config.Default, "AddColorPicker: Missing default value.")

	local Colorpicker = {
		Value = Config.Default,
		Transparency = Config.Transparency or 0,
		Type = "Colorpicker",
		Title = type(Config.Title) == "string" and Config.Title or "Colorpicker",
		Callback = Config.Callback or function(Color) end,
	}

	function Colorpicker:SetHSVFromRGB(Color)
		local H, S, V = Color3.toHSV(Color)
		Colorpicker.Hue = H
		Colorpicker.Sat = S
		Colorpicker.Vib = V
	end

	Colorpicker:SetHSVFromRGB(Colorpicker.Value)

	local ColorpickerFrame = require(Components.Element)(Config.Title, Config.Description, self.Container, true)

	Colorpicker.SetTitle = ColorpickerFrame.SetTitle
	Colorpicker.SetDesc = ColorpickerFrame.SetDesc

	local DisplayFrameColor = New("Frame", {
		Size = UDim2.fromScale(1, 1),
		BackgroundColor3 = Colorpicker.Value,
		Parent = ColorpickerFrame.Frame,
	}, {
		New("UICorner", {
			CornerRadius = UDim.new(0, 4),
		}),
	})

	local DisplayFrame = New("ImageLabel", {
		Size = UDim2.fromOffset(26, 26),
		Position = UDim2.new(1, -10, 0.5, 0),
		AnchorPoint = Vector2.new(1, 0.5),
		Parent = ColorpickerFrame.Frame,
		Image = "http://www.roblox.com/asset/?id=14204231522",
		ImageTransparency = 0.45,
		ScaleType = Enum.ScaleType.Tile,
		TileSize = UDim2.fromOffset(40, 40),
	}, {
		New("UICorner", {
			CornerRadius = UDim.new(0, 4),
		}),
		DisplayFrameColor,
	})

	local function CreateColorDialog()
		local Dialog = require(Components.Dialog):Create()
		Dialog.Title.Text = Colorpicker.Title
		Dialog.Root.Size = UDim2.fromOffset(430, 330)

		local Hue, Sat, Vib = Colorpicker.Hue, Colorpicker.Sat, Colorpicker.Vib
		local Transparency = Colorpicker.Transparency

		local function CreateInput()
			local Box = require(Components.Textbox)()
			Box.Frame.Parent = Dialog.Root
			Box.Frame.Size = UDim2.new(0, 90, 0, 32)

			return Box
		end

		local function CreateInputLabel(Text, Pos)
			return New("TextLabel", {
				FontFace = Font.new(
					"rbxasset://fonts/families/GothamSSm.json",
					Enum.FontWeight.Medium,
					Enum.FontStyle.Normal
				),
				Text = Text,
				TextColor3 = Color3.fromRGB(240, 240, 240),
				TextSize = 13,
				TextXAlignment = Enum.TextXAlignment.Left,
				Size = UDim2.new(1, 0, 0, 32),
				Position = Pos,
				BackgroundTransparency = 1,
				Parent = Dialog.Root,
				ThemeTag = {
					TextColor3 = "Text",
				},
			})
		end

		local function GetRGB()
			local Value = Color3.fromHSV(Hue, Sat, Vib)
			return { R = math.floor(Value.r * 255), G = math.floor(Value.g * 255), B = math.floor(Value.b * 255) }
		end

		local SatCursor = New("ImageLabel", {
			Size = UDim2.new(0, 18, 0, 18),
			ScaleType = Enum.ScaleType.Fit,
			AnchorPoint = Vector2.new(0.5, 0.5),
			BackgroundTransparency = 1,
			Image = "http://www.roblox.com/asset/?id=4805639000",
		})

		local SatVibMap = New("ImageLabel", {
			Size = UDim2.fromOffset(180, 160),
			Position = UDim2.fromOffset(20, 55),
			Image = "rbxassetid://4155801252",
			BackgroundColor3 = Colorpicker.Value,
			BackgroundTransparency = 0,
			Parent = Dialog.Root,
		}, {
			New("UICorner", {
				CornerRadius = UDim.new(0, 4),
			}),
			SatCursor,
		})

		local OldColorFrame = New("Frame", {
			BackgroundColor3 = Colorpicker.Value,
			Size = UDim2.fromScale(1, 1),
			BackgroundTransparency = Colorpicker.Transparency,
		}, {
			New("UICorner", {
				CornerRadius = UDim.new(0, 4),
			}),
		})

		local OldColorFrameChecker = New("ImageLabel", {
			Image = "http://www.roblox.com/asset/?id=14204231522",
			ImageTransparency = 0.45,
			ScaleType = Enum.ScaleType.Tile,
			TileSize = UDim2.fromOffset(40, 40),
			BackgroundTransparency = 1,
			Position = UDim2.fromOffset(112, 220),
			Size = UDim2.fromOffset(88, 24),
			Parent = Dialog.Root,
		}, {
			New("UICorner", {
				CornerRadius = UDim.new(0, 4),
			}),
			New("UIStroke", {
				Thickness = 2,
				Transparency = 0.75,
			}),
			OldColorFrame,
		})

		local DialogDisplayFrame = New("Frame", {
			BackgroundColor3 = Colorpicker.Value,
			Size = UDim2.fromScale(1, 1),
			BackgroundTransparency = 0,
		}, {
			New("UICorner", {
				CornerRadius = UDim.new(0, 4),
			}),
		})

		local DialogDisplayFrameChecker = New("ImageLabel", {
			Image = "http://www.roblox.com/asset/?id=14204231522",
			ImageTransparency = 0.45,
			ScaleType = Enum.ScaleType.Tile,
			TileSize = UDim2.fromOffset(40, 40),
			BackgroundTransparency = 1,
			Position = UDim2.fromOffset(20, 220),
			Size = UDim2.fromOffset(88, 24),
			Parent = Dialog.Root,
		}, {
			New("UICorner", {
				CornerRadius = UDim.new(0, 4),
			}),
			New("UIStroke", {
				Thickness = 2,
				Transparency = 0.75,
			}),
			DialogDisplayFrame,
		})

		local SequenceTable = {}

		for Color = 0, 1, 0.1 do
			table.insert(SequenceTable, ColorSequenceKeypoint.new(Color, Color3.fromHSV(Color, 1, 1)))
		end

		local HueSliderGradient = New("UIGradient", {
			Color = ColorSequence.new(SequenceTable),
			Rotation = 90,
		})

		local HueDragHolder = New("Frame", {
			Size = UDim2.new(1, 0, 1, -10),
			Position = UDim2.fromOffset(0, 5),
			BackgroundTransparency = 1,
		})

		local HueDrag = New("ImageLabel", {
			Size = UDim2.fromOffset(14, 14),
			Image = "http://www.roblox.com/asset/?id=12266946128",
			Parent = HueDragHolder,
			ThemeTag = {
				ImageColor3 = "DialogInput",
			},
		})

		local HueSlider = New("Frame", {
			Size = UDim2.fromOffset(12, 190),
			Position = UDim2.fromOffset(210, 55),
			Parent = Dialog.Root,
		}, {
			New("UICorner", {
				CornerRadius = UDim.new(1, 0),
			}),
			HueSliderGradient,
			HueDragHolder,
		})

		local HexInput = CreateInput()
		HexInput.Frame.Position = UDim2.fromOffset(Config.Transparency and 260 or 240, 55)
		CreateInputLabel("Hex", UDim2.fromOffset(Config.Transparency and 360 or 340, 55))

		local RedInput = CreateInput()
		RedInput.Frame.Position = UDim2.fromOffset(Config.Transparency and 260 or 240, 95)
		CreateInputLabel("Red", UDim2.fromOffset(Config.Transparency and 360 or 340, 95))

		local GreenInput = CreateInput()
		GreenInput.Frame.Position = UDim2.fromOffset(Config.Transparency and 260 or 240, 135)
		CreateInputLabel("Green", UDim2.fromOffset(Config.Transparency and 360 or 340, 135))

		local BlueInput = CreateInput()
		BlueInput.Frame.Position = UDim2.fromOffset(Config.Transparency and 260 or 240, 175)
		CreateInputLabel("Blue", UDim2.fromOffset(Config.Transparency and 360 or 340, 175))

		local AlphaInput
		if Config.Transparency then
			AlphaInput = CreateInput()
			AlphaInput.Frame.Position = UDim2.fromOffset(260, 215)
			CreateInputLabel("Alpha", UDim2.fromOffset(360, 215))
		end

		local TransparencySlider, TransparencyDrag, TransparencyColor
		if Config.Transparency then
			local TransparencyDragHolder = New("Frame", {
				Size = UDim2.new(1, 0, 1, -10),
				Position = UDim2.fromOffset(0, 5),
				BackgroundTransparency = 1,
			})

			TransparencyDrag = New("ImageLabel", {
				Size = UDim2.fromOffset(14, 14),
				Image = "http://www.roblox.com/asset/?id=12266946128",
				Parent = TransparencyDragHolder,
				ThemeTag = {
					ImageColor3 = "DialogInput",
				},
			})

			TransparencyColor = New("Frame", {
				Size = UDim2.fromScale(1, 1),
			}, {
				New("UIGradient", {
					Transparency = NumberSequence.new({
						NumberSequenceKeypoint.new(0, 0),
						NumberSequenceKeypoint.new(1, 1),
					}),
					Rotation = 270,
				}),
				New("UICorner", {
					CornerRadius = UDim.new(1, 0),
				}),
			})

			TransparencySlider = New("Frame", {
				Size = UDim2.fromOffset(12, 190),
				Position = UDim2.fromOffset(230, 55),
				Parent = Dialog.Root,
				BackgroundTransparency = 1,
			}, {
				New("UICorner", {
					CornerRadius = UDim.new(1, 0),
				}),
				New("ImageLabel", {
					Image = "http://www.roblox.com/asset/?id=14204231522",
					ImageTransparency = 0.45,
					ScaleType = Enum.ScaleType.Tile,
					TileSize = UDim2.fromOffset(40, 40),
					BackgroundTransparency = 1,
					Size = UDim2.fromScale(1, 1),
					Parent = Dialog.Root,
				}, {
					New("UICorner", {
						CornerRadius = UDim.new(1, 0),
					}),
				}),
				TransparencyColor,
				TransparencyDragHolder,
			})
		end

		local function Display()
			SatVibMap.BackgroundColor3 = Color3.fromHSV(Hue, 1, 1)
			HueDrag.Position = UDim2.new(0, -1, Hue, -6)
			SatCursor.Position = UDim2.new(Sat, 0, 1 - Vib, 0)
			DialogDisplayFrame.BackgroundColor3 = Color3.fromHSV(Hue, Sat, Vib)

			HexInput.Input.Text = "#" .. Color3.fromHSV(Hue, Sat, Vib):ToHex()
			RedInput.Input.Text = GetRGB()["R"]
			GreenInput.Input.Text = GetRGB()["G"]
			BlueInput.Input.Text = GetRGB()["B"]

			if Config.Transparency then
				TransparencyColor.BackgroundColor3 = Color3.fromHSV(Hue, Sat, Vib)
				DialogDisplayFrame.BackgroundTransparency = Transparency
				TransparencyDrag.Position = UDim2.new(0, -1, 1 - Transparency, -6)
				AlphaInput.Input.Text = require(Root):Round((1 - Transparency) * 100, 0) .. "%"
			end
		end

		Creator.AddSignal(HexInput.Input.FocusLost, function(Enter)
			if Enter then
				local Success, Result = pcall(Color3.fromHex, HexInput.Input.Text)
				if Success and typeof(Result) == "Color3" then
					Hue, Sat, Vib = Color3.toHSV(Result)
				end
			end
			Display()
		end)

		Creator.AddSignal(RedInput.Input.FocusLost, function(Enter)
			if Enter then
				local CurrentColor = GetRGB()
				local Success, Result = pcall(Color3.fromRGB, RedInput.Input.Text, CurrentColor["G"], CurrentColor["B"])
				if Success and typeof(Result) == "Color3" then
					if tonumber(RedInput.Input.Text) <= 255 then
						Hue, Sat, Vib = Color3.toHSV(Result)
					end
				end
			end
			Display()
		end)

		Creator.AddSignal(GreenInput.Input.FocusLost, function(Enter)
			if Enter then
				local CurrentColor = GetRGB()
				local Success, Result =
					pcall(Color3.fromRGB, CurrentColor["R"], GreenInput.Input.Text, CurrentColor["B"])
				if Success and typeof(Result) == "Color3" then
					if tonumber(GreenInput.Input.Text) <= 255 then
						Hue, Sat, Vib = Color3.toHSV(Result)
					end
				end
			end
			Display()
		end)

		Creator.AddSignal(BlueInput.Input.FocusLost, function(Enter)
			if Enter then
				local CurrentColor = GetRGB()
				local Success, Result =
					pcall(Color3.fromRGB, CurrentColor["R"], CurrentColor["G"], BlueInput.Input.Text)
				if Success and typeof(Result) == "Color3" then
					if tonumber(BlueInput.Input.Text) <= 255 then
						Hue, Sat, Vib = Color3.toHSV(Result)
					end
				end
			end
			Display()
		end)

		if Config.Transparency then
			Creator.AddSignal(AlphaInput.Input.FocusLost, function(Enter)
				if Enter then
					pcall(function()
						local Value = tonumber(AlphaInput.Input.Text)
						if Value >= 0 and Value <= 100 then
							Transparency = 1 - Value * 0.01
						end
					end)
				end
				Display()
			end)
		end

		Creator.AddSignal(SatVibMap.InputBegan, function(Input)
			if
				Input.UserInputType == Enum.UserInputType.MouseButton1
				or Input.UserInputType == Enum.UserInputType.Touch
			then
				while UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) do
					local MinX = SatVibMap.AbsolutePosition.X
					local MaxX = MinX + SatVibMap.AbsoluteSize.X
					local MouseX = math.clamp(Mouse.X, MinX, MaxX)

					local MinY = SatVibMap.AbsolutePosition.Y
					local MaxY = MinY + SatVibMap.AbsoluteSize.Y
					local MouseY = math.clamp(Mouse.Y, MinY, MaxY)

					Sat = (MouseX - MinX) / (MaxX - MinX)
					Vib = 1 - ((MouseY - MinY) / (MaxY - MinY))
					Display()

					RenderStepped:Wait()
				end
			end
		end)

		Creator.AddSignal(HueSlider.InputBegan, function(Input)
			if
				Input.UserInputType == Enum.UserInputType.MouseButton1
				or Input.UserInputType == Enum.UserInputType.Touch
			then
				while UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) do
					local MinY = HueSlider.AbsolutePosition.Y
					local MaxY = MinY + HueSlider.AbsoluteSize.Y
					local MouseY = math.clamp(Mouse.Y, MinY, MaxY)

					Hue = ((MouseY - MinY) / (MaxY - MinY))
					Display()

					RenderStepped:Wait()
				end
			end
		end)

		if Config.Transparency then
			Creator.AddSignal(TransparencySlider.InputBegan, function(Input)
				if Input.UserInputType == Enum.UserInputType.MouseButton1 then
					while UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) do
						local MinY = TransparencySlider.AbsolutePosition.Y
						local MaxY = MinY + TransparencySlider.AbsoluteSize.Y
						local MouseY = math.clamp(Mouse.Y, MinY, MaxY)

						Transparency = 1 - ((MouseY - MinY) / (MaxY - MinY))
						Display()

						RenderStepped:Wait()
					end
				end
			end)
		end

		Display()

		Dialog:Button("Done", function()
			Colorpicker:SetValue({ Hue, Sat, Vib }, Transparency)
		end)
		Dialog:Button("Cancel")
		Dialog:Open()
	end

	function Colorpicker:Display()
		Colorpicker.Value = Color3.fromHSV(Colorpicker.Hue, Colorpicker.Sat, Colorpicker.Vib)

		DisplayFrameColor.BackgroundColor3 = Colorpicker.Value
		DisplayFrameColor.BackgroundTransparency = Colorpicker.Transparency

		Element.Library:SafeCallback(Colorpicker.Callback, Colorpicker.Value)
		Element.Library:SafeCallback(Colorpicker.Changed, Colorpicker.Value)
	end

	function Colorpicker:SetValue(HSV, Transparency)
		local Color = Color3.fromHSV(HSV[1], HSV[2], HSV[3])

		Colorpicker.Transparency = Transparency or 0
		Colorpicker:SetHSVFromRGB(Color)
		Colorpicker:Display()
	end

	function Colorpicker:SetValueRGB(Color, Transparency)
		Colorpicker.Transparency = Transparency or 0
		Colorpicker:SetHSVFromRGB(Color)
		Colorpicker:Display()
	end

	function Colorpicker:OnChanged(Func)
		Colorpicker.Changed = Func
		Func(Colorpicker.Value)
	end

	function Colorpicker:Destroy()
		ColorpickerFrame:Destroy()
		Library.Options[Idx] = nil
	end

	Creator.AddSignal(ColorpickerFrame.Frame.MouseButton1Click, function()
		CreateColorDialog()
	end)

	Colorpicker:Display()

	Library.Options[Idx] = Colorpicker
	return Colorpicker
end

return Element
