Support for the Acceptance of Words for Common Colors (i.e. "Red" for 255, 0, 0)

Hello everyone,

As a Roblox developer, it is currently a little bit tedious to have to use RGB or HSV when it comes to frequently used colors. Allow me to explain:

For example, if I wanted to set a text label’s background color to black, it seems quite redundant that I would have to type Color3.fromRGB(0, 0, 0), or any other variants, just to set a property to this common color.

For very popular hues; such as black, red, blue, white, and etc.; I would at least expect that they would have their own, unique syntax. For instance, BrickColor3 can be set with a string (such as “Institutional white”). Similarly, I would request the ability to do TextLabel.TextColor3 = "Black".

“Color words” can either be keywords (i.e.workspace with a special, blue highlight) or just strings (i.e.“Fossil” for BrickColor3).

If anyone is familiar with colors in CSS, you can use words like “white”, “red”, “blue”, “black”, etc. as alternatives to typing RGB or HEX.


All three methods do the same thing (set the background color to pure black), but simply stating the word is the easiest way. I am requesting that Roblox’s Lua can accept “Black” as an alternative to Color3.fromRGB(0, 0, 0).


An example list of the colors (RGB) that should have word counterparts:

  • Red (255, 0, 0)
  • Green (0, 255, 0)
  • Blue (0, 0, 255)
  • Yellow (255, 255, 0)
  • Pink (255, 0, 255)
  • Cyan (0, 255, 255)
  • Black (0, 0, 0)
  • White (255, 255, 255)
  • Various shades of gray (100, 100, 100) (200, 200, 200) etc.

I understand that you can define variables and (for example, local red = Color3.fromRGB(255, 0, 0)), but as an analogy, the keyword workspace exists even when you can set that as a variable. Why? It’s downright easier to use than game:GetService("Workspace") or game.Workspace! In programming, a method, a snippet of code, or even a simple math operation that is commonly used a lot gets revamped and made easier to use.

An example of there being an alternative to a math operation used very often can be found in JavaScript. The operation of x = x + y (which is simple enough) can also be written as x += y (a lot shorter, a lot easier). (Find out more here)


Use Case

Basically, all use cases are scripting-related.

local button = script.Parent

button.MousEnter:Connect(function()

    button.BackgroundColor3 = "Black"
    Button.TextColor3 = "White"

end)

button.MousEnter:Connect(function()

    button.BackgroundColor3 = "White"
    Button.TextColor3 = "Black"

end)

If this feature was to be added, it would improve my development experience because scripting (at least, personally) would be a lot quicker and more efficient. As a UI designer, I tend to refer a lot to colors, and I can guarantee that most of them are the exact same colors as the ones used by other developers. The ability to simply write the word for a color is what I am requesting. After all, scripting is achieving something with the least effort, but with maximum efficiency and speed.

Also, do keep in mind that color does not only affect UIs, but also building; therefore, builders and UI designers would be the most benefit from this. But anyone who regularly accesses color would find this feature very handy.

This would bring us, developers, one step closer to paying less attention to basic things (like referencing color) and being more attentive towards important matters at hand.

I hope others find this as useful as I do,
and thank you for reading!

1 Like

You mentioned BrickColor, and honestly, this sounds like a use case for that to me.
There are a lot of premade colors that can all be used like that, even for UI.

button.MouseEnter:Connect(function()
    
    button.BackgroundColor3 = BrickColor.new("Black").Color
    button.TextColor3 = BrickColor.new("White").Color

end)

If the main reason for wanting to be able to set color properties as strings is because it is shorter/faster to type, that is probably not going to happen. Many feature requests are made for similar reasons and are shut down.

7 Likes

But what about the keyword workspace, itsn’t it a shorter and easier version of game.Workspace? I know this feature is very minor and may even go without being added, but I’d always be good if it was added.

This may or may not happen. I understand that this is pretty annoying. As an alternative, you can create a block of color variables in your scripts.

local red = Color3.new(1, 0, 0)
local white = Color3.new(1, 1, 1)

brick.Color = red

Of course, even though it is mostly deprecated, our old friend the BrickColor can still be applied directly to most color properties of GUIs by omitting the 3 in their names.

button.TextColor = BrickColor.new("Institutional white")

We also have BrickColor in Parts.

brick.BrickColor = BrickColor.new("Medium stone grey")
2 Likes

I mean. You could also just make your own dictionary, holding each of these for use. I don’t personally see the need for an official channel to create that in the backend. And once you have the framework for this, you could add all sorts of things that would never be supported officially. (A good example being more “rare” colors like maroon, magenta, fuscia, tan, indigo, etc)

Also you could use such a dictionary to set up a custom baseline “red” for a game that perhaps is trying for a more dulled out cartoony look rather than an over powering red like 255, 0, 0

3 Likes