--[[
	~= EXAMPLE CODE =~
	return function(gui,gTable,guiData)
		local name = gTable.Name
		if name == "YesNoPrompt" then
			local new = Instance.new("ScreenGui")
			local frame = Instance.new("Frame",new)
			frame.Size = UDim2.new(0,400,0,400)
			local yes = Instance.new("TextButton",frame)
			yes.Size = UDim2.new(0.5,0,1,0)
			yes.Text = "Yes"
			local no = yes:Clone()
			no.Text = "No"
			no.Position = UDim2.new(0.5,0,0,0)
			
			local gTable,gIndex = client.UI.Register(new)
			
			local ans
			local waiting = true
			
			gTable.CustomDestroy = function()
				waiting = false
			end
			
			yes.MouseButton1Click:Connect(function()
				ans = "Yes"
				gTable:Destroy()
			end)
			
			no.MouseButton1Click:Connect(function()
				ans = "No"
				gTable:Destroy()
			end)
			
			repeat wait() until ans or not waiting  --// Wait until answer
			return ans or false
		end
	end
	
--]]


service = nil
client = nil

return function(gui: ScreenGui, guiData, gTable)
	local TWEEN_TIME = 2
	local SEQUENCE = {
		Color3.fromRGB(255, 85, 88), 
		Color3.fromRGB(78, 140, 255), 
		Color3.fromRGB(78, 255, 149)
	}
	local CLASSES = {
		Frame = true;
		TextBox = true;
		TextLabel = true;
		TextButton = true;
		ImageLabel = true;
		ImageButton = true; 
		ScrollingFrame = true;
	}
	
	local contents = {}
	local OrgColors = {}
	
	local function getCont(obj)
		for _, v in obj:GetChildren() do 
			if CLASSES[v.ClassName] then
				local OrgColor = {}
				OrgColor.Background = v.BackgroundColor3
				if v:IsA("ImageLabel") or v:IsA("ImageButton") then 
					OrgColor.Image = v.ImageColor3 
				end
				OrgColors[v] = OrgColor
				table.insert(contents, v)
				getCont(v)
			end
		end
	end
	
	getCont(gui)
	
	if gTable.Name == "List" then
		gui.Drag.Main.BackgroundTransparency = 0
	end
	
	local function tweenToColor(color1, color2, time)
		local Info = TweenInfo.new(time, Enum.EasingStyle.Linear)
		for _, v in contents do
			local orgcolor = OrgColors[v]
			v.BackgroundColor3 = color1:lerp(orgcolor.Background, 0.75)
			if orgcolor.Image then
				v.ImageColor3 = color1:lerp(orgcolor.Image, 0.75)
				service.TweenService:Create(v, Info, {
					BackgroundColor3 = color2:lerp(orgcolor.Background, 0.75),
					ImageColor3 = color2:lerp(orgcolor.Image, 0.75)
				}):Play()
			else
				service.TweenService:Create(v, Info, {
					BackgroundColor3 = color2:lerp(orgcolor.Background, 0.75)
				}):Play()
			end
		end
		task.wait(time)
	end
	
	service.TrackTask(`Thread: Colorize_{gTable.Name}`,function()
		repeat 
			for i in SEQUENCE do
				local one, two = SEQUENCE[i], SEQUENCE[i+1] or SEQUENCE[1]
				
				tweenToColor(one, two, TWEEN_TIME)
			end
		until not task.wait(if gTable.Active then 0 else 1) and gTable.Destroyed
		
	end)
end
