[Color Wheel] Force Color

I’m trying to force a color to be set on the color wheel but I’m not too sure how to go about it. So far I’ve tried to just set the display to the RGB color but then noticed that the script is based off of the mouse’s position within the frame. Wondering if someone could tell me how to go about reversing from color to mouse pos so I can then input the mouse pos i want and it’ll force the color - Or if there’s another solution?

local function updateColour(centreOfWheel)
	
	
	local colourPickerCentre = Vector2.new(
		wheelPicker.AbsolutePosition.X + (wheelPicker.AbsoluteSize.X/2),
		wheelPicker.AbsolutePosition.Y + (wheelPicker.AbsoluteSize.Y/2)
	)
	local h = (math.pi - math.atan2(colourPickerCentre.Y - centreOfWheel.Y, colourPickerCentre.X - centreOfWheel.X)) / (math.pi * 2)
	
	local s = (centreOfWheel - colourPickerCentre).Magnitude / (colourWheel.AbsoluteSize.X/2)
	
	local v = math.abs((darknessSlider.AbsolutePosition.Y - darknessPicker.AbsolutePosition.Y) / darknessPicker.AbsoluteSize.Y - 1)
	
	
	local hsv = Color3.fromHSV(math.clamp(h, 0, 1), math.clamp(s, 0, 1), math.clamp(v, 0, 1))
	
	
	colourDisplay.ImageColor3 = hsv
	darknessPicker.UIGradient.Color = ColorSequence.new{
		ColorSequenceKeypoint.new(0, hsv), 
		ColorSequenceKeypoint.new(1, Color3.new(0, 0, 0))
	}
end

colourWheel.MouseButton1Down:Connect(function()
	buttonDown = true
end)

darknessPicker.MouseButton1Down:Connect(function()
	movingSlider = true
end)


uis.InputEnded:Connect(function(input)
	
	if input.UserInputType ~= Enum.UserInputType.MouseButton1 then return end
	
	buttonDown = false
	movingSlider = false
end)


uis.InputChanged:Connect(function(input)
	
	if input.UserInputType ~= Enum.UserInputType.MouseMovement then return end
	
	
	local mousePos = uis:GetMouseLocation() - Vector2.new(0, game:GetService("GuiService"):GetGuiInset().Y)
	
	local centreOfWheel = Vector2.new(colourWheel.AbsolutePosition.X + (colourWheel.AbsoluteSize.X/2), colourWheel.AbsolutePosition.Y + (colourWheel.AbsoluteSize.Y/2))
	
	local distanceFromWheel = (mousePos - centreOfWheel).Magnitude
	
	
	if distanceFromWheel <= colourWheel.AbsoluteSize.X/2 and buttonDown then
		
		wheelPicker.Position = UDim2.new(0, mousePos.X - colourWheel.AbsolutePosition.X, 0, mousePos.Y - colourWheel.AbsolutePosition.Y)

		
	elseif movingSlider then
		
		darknessSlider.Position = UDim2.new(darknessSlider.Position.X.Scale, 0, 0, 
			math.clamp(
			mousePos.Y - darknessPicker.AbsolutePosition.Y, 
			0, 
			darknessPicker.AbsoluteSize.Y)
		)	
	end
	
	
	updateColour(centreOfWheel)
end)```