Color3 constants

As a developer, it’s annoying and visually noisy to constantly write out commonly-used Color3 values. I want constants added to the Color3 library that make it easy to read and write these values.

Color3 Color3.white --- Color3.new(1, 1, 1)
Color3 Color3.red --- Color3.new(1, 0, 0)
Color3 Color3.green --- Color3.new(0, 1, 0)
Color3 Color3.blue --- Color3.new(0, 0, 1)
Color3 Color3.black --- Color3.new(0, 0, 0)
Color3 Color3.yellow --- Color3.new(1, 1, 0)
Color3 Color3.cyan --- Color3.new(0, 1, 1)
Color3 Color3.magenta --- Color3.new(1, 0, 1)

If you’re feeling really goofy, add Color3.key = Color3.new(0, 0, 0) too

6 Likes

I think this would be a good addition but we are likely not to see it.
If you truly want it right now you could use this quick thing I made.

local usebrickcolor = true

local old = Color3
local Color3 = setmetatable({
	Red = Color3.new(1,0,0)
},{
	__index = function(self,index)
		local temp = self[index]
		
		if type(index) == "string" then
			return temp or BrickColor.new(index).Color
		end
		return temp
	end
})

for i,v in old do
	Color3[i] = v
end

table.freeze(Color3)

print(Color3.Red) --> Color3.new(1,0,0)```

Sorry if it's not what you're looking for
3 Likes

Out of curiosity, how often are you using fixed colors outside of black and white? In my experience pure reds and such are usually not what you want unless you’re doing shader things that we don’t have.

8 Likes

I would definitely get good use out of black & white constants

6 Likes

I’ve only ever wanted black and white constants, not sure about uses for other colors. I have my own module for my own game’s color scheme.

4 Likes

I usually use bright red/green for stuff like debug parts/guis when I just need a distinct color that stands out. Having the RGB as separate constants would definitely go a long way.

1 Like

Not sure if I support all the colors here (possible API pollution?), but I find myself changing the color of something to Color3(1,1,1) (white) or Color3(0,0,0) (black) through code quite often, and was surprised to see these don’t exist as constants.

Black is okay to type out, Color3.new(), but getting solid white takes an extra step for something used a lot as well, Color3.new(1,1,1) / Color3.fromRGB(255,255,255). Sounds like I’m being lazy, but for something used this often, it would be a nice convenience to have.

Color3.white and Color3.black would make this process a lot easier, and likely faster…?

2 Likes