I am trying to convert HSV to RGB for the purposes of my game but I don’t know exactly how to convert HSV to RGB. I’ve looked at other topics but all that I found were outdated and never found a solution.
Perhaps this can help?
Just do something like this:
local hsv = Color3.fromHSV(H,S,V)
local r = hsv.R
local g = hsv.G
local b = hsv.B
local rgbColor = Color3.fromRGB(r,g,b)
it keeps returning an HSV value instead of RGB, I did this
Color3.fromRGB(hsv.R, hsv.G, hsv.B)
my hsv color looks like this
local hsv = Color3.fromHSV(math.clamp(h, 0, 1), math.clamp(s, 0, 1), math.clamp(v, 0, 1))
Maybe try this?
Color3.fromRGB(hsv.R*255, hsv.G*255, hsv.B*255)
its saying that the red is that RGB which I know isn’t right
here is my code for the color updating (if this helps)
local colourPickerCentre = Vector2.new(
colourWheel.Picker.AbsolutePosition.X + (colourWheel.Picker.AbsoluteSize.X/2),
colourWheel.Picker.AbsolutePosition.Y + (colourWheel.Picker.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.BackgroundColor3 = hsv
darknessPicker.UIGradient.Color = ColorSequence.new{
ColorSequenceKeypoint.new(0, hsv),
ColorSequenceKeypoint.new(1, Color3.new(0, 0, 0))
}
local ColorRGB = Color3.fromRGB(hsv.R*255, hsv.G*255, hsv.B*255)
script.Parent.Color.Value = ColorRGB
script.Parent.Red.Text = ColorRGB.R*255
script.Parent.Green.Text = ColorRGB.R*255
script.Parent.Blue.Text = ColorRGB.B*255