Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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

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

1 comment

0

Yes, but the colors I have are in letters, so I'm not sure how I would convert it to letters or not.

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.