There are different ways to change colors with fromRGB, fromHex, and fromHSV. What is the point of using .new, if I can just use these ones?
Color3.new is just another option for setting colors. Why not have it?
Color3 is used for precise coloring of objects on screen through properties like BasePart.
So basically just Pick Color but using scripting?
You can use Color3 in scripting. For example, you may want to change the color of a part every few seconds you wouldn’t be able to achieve this without using a script.
EDIT: Coding example
while true do
part.Color = Color3.new(253, 20, 242)
task.wait(2)
part.Color = Color3.new(0, 255, 0)
end
That still doesn’t make sense to me but thanks haha
With numbers ranging from 0-255, you would use Color3.FromRGB.
Color3 is more:
Universal.
Precise.
Colorful.
overall Better.
Color3.new was most likely the oldest method of setting colors, ranging from 0 to 1 until roblox bring out the Color3.fromRGB.
There’s not a lot of uses for Color3.new nowadays. It has almost been replaced by other ways like fromRBG, fromHSV, etc.
I doubt anyone uses some of these, but some scenarios include:
- Supposedly, numerous APIs uses these kinds of values. That’s one way, we could grab those kinds of values and use it for our code.
- From this kind of range in a programmer’s perspective, you get to understand the percentage of how much the colors are.
So let’s say if blue is 0.6, it means that color would be 60% blue. - Lerping could be made easier since it only provides the value 0 to 1.
- If you’re just lazy to type it out.
white = Color3.new(1,1,1)
white = Color3.FromRGB(255,255,255)
Each method of creating a color has it’s own use case.
fromRGB()
is used when you want to create a color using rgb values.
fromHSV()
is used when you want to create a color using hsv values.
fromHex()
is used when you want to create a color using a hexadecimal value.
new
is used when you want to create a color using percentages. All colors will be printed out as 0-1
.
None are obsolete and each one is better in different circumstances. For example, using hexadecimal is preferred if memory is a concern.
Take a look: