Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

In Roblox, does BackgroundColor take the value of a BrickColor?

Asked by 9 years ago

I'm doing this script, but my TextLabel's color is in RGB values [0,0,255], etc.., but the color I'm passing in is in letters(BrickColor), will the script work? Or do I need to convert the BrickColor to RGB values? If so, how would I go about doing this?

Thank you!

3 answers

Log in to vote
0
Answered by
ImageLabel 1541 Moderation Voter
9 years ago

Possible approaches

BrickColor

Since all possible values for the property BackgroundColor3 must be Color3 values or values of similar nature, you would have to convert the BrickColor value into a readable Color3 value.

myBrickColor = BrickColor.new('Royal purple')
myColor3 = myBrickColor.Color

Color3

You would have to divide all arguments by 255 in order to get the proper or desired color, because all Color3 values are meant to be ranged from 0 - 1.

function Color(red, green, blue)
    return Color3.new(red/255, green/255, blue/255)
end
Ad
Log in to vote
0
Answered by
Codebot 85
9 years ago

idk if its possible with letters, but I always just do (G/255,R/255,B/255) Example: (2/255, 19/255, 78/255)

0
Yes, but the colors I have are in letters, so I'm not sure how I would convert it to letters or not. PresidentAlvarez 5 — 9y
Log in to vote
0
Answered by 9 years ago

BackgroundColor3 is a Color3 value, all things in guis that involve colors are color3 values. Example of creating a color3 value

local color = Color3.new(255/255, 122/255, 25/255)

You have to add /255 to each value or have the value between 0 and 1. 1 would == 255/255. and 0 would be 0/255.

If you wanted to get the color of a BrickColor you can do BrickColor.new("Bright blue").Color

EDIT: Color3(red, green, blue) (R G B)

Answer this question