I am trying to get the actual RGB value from a Color3 Object but it keeps returning HSV, how can i get the RGB instead of HSV
Can you paste some of your code? Color3
returns a color object which will work for any property requiring a Color3
data type. For Example:
script.Parent.BackgroundColor3 = Color3.fromHSV(0,0,0)
script.Parent.BackgroundColor3 = Color3.fromRGB(255,0,0)
They are different colors but both valid. Maybe you want to construct your color with RGB, if so, use Color3.fromRGB
.
How do you know it’s HSV? What property of a Color3
did you read?
A Color3
can be constructed in many ways. Such as from Color3.fromRGB
, Color3.fromHSV
or Color3.new
.
Reference: Color3
local function Color3toRGB(color : Color3)
local r, g, b = color.R * 255, color.G * 255, color.B * 255
return Color3.fromRGB(r, g, b), r, g, b
end
local color, r, g, b = Color3toRGB(Color3.new(1, 1, 1))
print(r, g, b) --255 255 255
The Color3 class doesn’t have a “Color3.toRGB” function as it wouldn’t really be necessary, you can simply multiply/divide the color’s individual color channels (components) by 255 to switch between a regular “Color3.new()” color and a “Color3.fromRGB()” color.