New parameter for Print that allows us to specify the color of the line that's printed

Simple request, I’d like to be able to do something like

print(“Green test”, Color3.new(0, 1, 0))

and it would print “Green test” in green or whatever color I had specified.

10 Likes

This wouldn’t work because print can take a variable number of arguments. That code will currently print the value of the Color3 object. It can’t be changed to not do this, because it wouldn’t be backwards compatible.

> print("Green test", Color3.new(0, 1, 0))
Green test 0, 1, 0
12 Likes

Could it be implemented in a way similar to the JavaScript console?

Not particularly familiar with how print handles string patterns, but I’m assuming this request is still possible, even if not the way OP described.

Print doesn’t do string patterns at all. It prints the value of tostring for each of its arguments, separating them with a space.

2 Likes

What do you intend to use this for? If it’s for something really niche, you can just create your own output display and have it so “[0,1,0]: test 1 2 3” displays as “test 1 2 3” in green text.

I was intending to use it for differentiating different print outputs by color.

2 Likes

I’d never use it

2 Likes

Debug(Color3, turple of things to print) ?

1 Like

Can you fix tabs not printing in the output? It’s screwed up my animation exporter.

Support. Just add a second print/warn function where the last variable is a color3 value. I hate having to add stupid stuff to my prints so it can catch my eye more easily when Im looking for it.

debug.log(message, color/enum MessageType)

1 Like

This along with the MessageType becoming Enum.MessageType.Custom if that parameter is a color would probably be the best. (would need to add .Custom if it doesn’t exist yet, which it probably doesn’t) Updating already existing consoles (most notably F9) wouldn’t be too hard

Perhaps just two separate methods would be a better solution?

debug.log
debug.logMessage (poorly named)

For what purpose?

One to take a Color3, another to an Enum. I’m not a fan of methods with parameters that affect other ones (such as MessageType.Custom)

I mean your syntax:

debug.log(string message, MessageType/Color3 colorOrType)`
If you give it a Color3, the MessageType would (internally) become Custom.
*(as it would be a bit weird if LogService.MessageOut has a Color3 or nil as messageType)*
So either you use an enum, which determines the color, or you use a color, which sets the enum to Custom.
2 Likes

Bumping this, Ive wanted this for a long time now.

Although you couldnt put a color3 or something at the end, you could instead do print(text):Color3 to insert the color.