Why does Color3.new take args ranging from 0-1?

If you go to the Color3 API reference page, you will see new and fromRGB as some of the constructor functions for a Color3 instance.

The new function takes arguments raning from 0-1, where fromRGB takes arguments from 0-255. What could be a usecase for wanting to use the former over the latter?

I see common mistakes where people use the new constructor giving arguments higher than what is expected. So what’s the purpose of new?

It’s common to see 0-1 values used to represent whole ranges within various APIs. The fromRGB constructor was added years later for its simplicity.

Possible use-cases for either:

new

  • Easier to mathematically compute a color given a 0-1 range (e.g. lerping, before there was a Lerp function for Color3s)
  • A bit easier to understand the percentages of each parameter (e.g. a red of 0.25 is obviously 25%, but it’s full-range number would be 64)

fromRGB

  • Easier to read usually
  • Easily transferable from a color picker or color property

I use fromRGB more than new.

4 Likes