Color3s are NOT RGBs!


  • Yep, it needs to be said. Color3s are not RGBs.

    I posted this in the tutorials section, because I am going to further explain what I mean.

    Color3s, The Basics.

    Color3.new(200,0,100) should give you a purplish color, right? No. Color3s and RGBs are not the same thing. Color3s are ROBLOX's own way of making colors. Color3 values need to be between 0 and 1. This often confuses scripters who try to use Color3s.

    But you want an RGB value in your game. You got the color, and you know the RGB values. But how do you put the color into your game? Roblox has something made just for this! It's called fromRGB.

    Color3.fromRGB(200,0,100) will indeed get you that purplish color you want. Lets say you want to use new instead of fromRGB (idk why), then you could divide all the values by 255 to get the Color3 to work. But why do Color3.new(200/255,0,100/255) when fromRGB does that for you?

    Real Example

    In this example I am going to make a Part's Color property change into that purplish color we were talking about.

    local part = Instance.new("Part")
    part.Color = Color3.fromRGB(200,0,100)
    part.Parent = workspace
    

    Conclusion

    I hope this short tutorial helped you guys to understand a little bit how Color3s work, and how Color3s and RGBs are two different things.


  • @Thundermaker300 Nice explanation. I'm pretty sure using math to do Color3.new is not really efficient since it needs to calculate what each number is. Also, they should just remove Color3.new completely.


  • @hiimgoodpack idk it could mess up a lot of things


  • I normally just use Color3.new() and decimal values.

    If I ever wanted a really specific color I might use fromRGB, but I don't think it's a big deal.

    Most of the time I normally want something completely white or completely black anyways.


  • @CootKitty Well, using decimal values are not easy to read. You can't easily tell that Color3.new(1, 0.70588235294118, 0) was orange, could you?


  • @hiimgoodpack With a lot of practice you can probably learn to tell the difference with decimals.


  • @hiimgoodpack 100% red, 70% green, 0% blue.

    Makes sense to me

    Using .7 would be easier and realistically the same, also.


  • @CootKitty Well kinda but its easier just to go glance at a RGB value


  • @hiimgoodpack some might be more familiar with Color3 than RGB.


  • @hiimgoodpack Easy is subjective.

    What I find simpler might be harder for you, and vice versa.

    Neither way is incorrect.

  • Global Moderator

    @Thundermaker300 That's still RGB. The difference is the components are normalized.


  • Nice tutorial Thunder. It's a good tutorial but just one little tiny mistake ,like link said, it;s still rgb but just with the values being changed to 0-1. Keep up the good work.

Log in to reply
 

Looks like your connection to Scripting Helpers was lost, please wait while we try to reconnect.