Is there a way to transform Color3.new to Color3.fromRGB because .new is only 0-1 I want to make that value 0-255 is there a way?
You could just do
local ConvertToSmallRed = Color3.new(1 / 255, 0, 0)
?
2 Likes
Multiply it by 255. Color.new is calculated by taking Color3.fromRGB by dividing it by 255, so you can do the opposite to get color3.fromRGB.
6 Likes
Do you have a code example? Why do you need to ‘transform’ it?
mycolor = Color3.fromRGB(127, 127, 127)
is the same as:
mycolor = Color3.new(.5,.5,.5)
Am I missing something here?
1 Like
Use this function to convert Color3.new()
into color3.fromRGB()
.
function ColorNewToColorRGB(col)
return math.clamp(math.ceil(col.R * 255), 0, 255),
math.clamp(math.ceil(col.G * 255), 0, 255),
math.clamp(math.ceil(col.B * 255), 0, 255),
end
Calling the function
local cR,cG,cB = ColorNewToColorRGB(Color3.new(0,1,0))
cR, cG, cB
are the color.fromRGB()
values. rnd()
is a shortend version to round the number to a whole number. clmp()
is so that the number does not go over 255.
1 Like