Coloring your server name! (and console text too)

Coloring your server name! (and console text too)

What permissions do you give others to modify and/or maintain your submission?
Modify: ASK ME - Maintain: IN MY ABSENCE - Others must ask me for permission before modifying my submission or use it in their own work, and I reserve the right to say no for any reason. However, if I can no longer be contacted, I give permission for my entire submission to be maintained by others.
I made sure my file(s) follow the Submissions Guidelines
  1. Yes
I named my file(s) correctly (see Filename Conventions)
  1. Yes
I'm at least 28% sure that when you first tried to figure out how to get a colored title for your server, you found this 2011 post (among other results, but this was the first one).

I figured I could try going slightly more in-depth, update it to recent versions and mention other uses.

Let's start with an important bit: As a player, you can't change your name's not chat's color. It was possible in ancient versions, but not anymore since 2.0 or so.
However, you can use these to echo text in colors, to colorize your server's name, or as a modder, to colorize chat and player names!



There are two ways of text coloring you can follow:

1: caret codes​

Writing a caret ^ followed by a number from 0 to 7 (from 2.2.9, from 0 to 9 or A to F makes a classic color code.

Caret color codes are recognized in a few spaces, like SOC based text (player select entries, cutscene text, others?) and, of course, the server name field.
This is the easiest way to color your server name, but it may not show up properly on the in-game server list (it still works as intended on the web browser).

Keep in mind that this method takes up two whole characters per code!

Usage example:
This is a ^2yellow^0 ring!

2: ascii symbols​

Did you know that internally, color codes are treated differently?
In the ASCII standard, there are 127 slots for characters, and a good chunk of these slots are used for actual, printable (the ones you can actually visualize on screen, like here right now!) stuff. This leaves some slots for control characters. Slots 127 and up are used by the "extended ASCII" standard for special characters like Ä, Æ or even , but since SRB2 doesn't support these characters, they are used to colorize text instead!
Ever wondered why your "echo" script, your Lua lump or anything with a weird symbol would colorize the whole line? There you go.

You can find a grid of these symbols here:
Code:
80 <€> | 90 <> | A0 < > | B0 <°> | C0 <À> | D0 <Ð> | E0 <à> | F0 <ð> |
81 <> | 91 <‘> | A1 <¡> | B1 <±> | C1 <Á> | D1 <Ñ> | E1 <á> | F1 <ñ> |
82 <‚> | 92 <’> | A2 <¢> | B2 <²> | C2 <Â> | D2 <Ò> | E2 <â> | F2 <ò> |
83 <ƒ> | 93 <“> | A3 <£> | B3 <³> | C3 <Ã> | D3 <Ó> | E3 <ã> | F3 <ó> |
84 <„> | 94 <”> | A4 <¤> | B4 <´> | C4 <Ä> | D4 <Ô> | E4 <ä> | F4 <ô> |
85 <…> | 95 <•> | A5 <¥> | B5 <µ> | C5 <Å> | D5 <Õ> | E5 <å> | F5 <õ> |
86 <†> | 96 <–> | A6 <¦> | B6 <¶> | C6 <Æ> | D6 <Ö> | E6 <æ> | F6 <ö> |
87 <‡> | 97 <—> | A7 <§> | B7 <·> | C7 <Ç> | D7 <×> | E7 <ç> | F7 <÷> |
88 <ˆ> | 98 <˜> | A8 <¨> | B8 <¸> | C8 <È> | D8 <Ø> | E8 <è> | F8 <ø> |
89 <‰> | 99 <™> | A9 <©> | B9 <¹> | C9 <É> | D9 <Ù> | E9 <é> | F9 <ù> |
8A <Š> | 9A <š> | AA <ª> | BA <º> | CA <Ê> | DA <Ú> | EA <ê> | FA <ú> |
8B <‹> | 9B <›> | AB <«> | BB <»> | CB <Ë> | DB <Û> | EB <ë> | FB <û> |
8C <Œ> | 9C <œ> | AC <¬> | BC <¼> | CC <Ì> | DC <Ü> | EC <ì> | FC <ü> |
8D <> | 9D <> | AD <> | BD <½> | CD <Í> | DD <Ý> | ED <í> | FD <ý> |
8E <Ž> | 9E <ž> | AE <®> | BE <¾> | CE <Î> | DE <Þ> | EE <î> | FE <þ> |
8F <> | 9F <Ÿ> | AF <¯> | BF <¿> | CF <Ï> | DF <ß> | EF <ï> | FF <ÿ> |

A demo:
srb2colorgrid.png


Some characters, such as hex 8F (unused), have no proper representation but are rendered here as a symbol that resembles one of these: ▯□�.

Some characters, like hex AD (soft hyphen), can't or won't be rendered and will show up as an empty character between the <>s.
Copy and paste the whole thing, then try placing the text cursor to the right of > and press left twice. You'll notice the cursor getting stuck once: that's where the character is.

How each character ends up looking after a copy and paste might vary based on font, software, and probably platform.

Using an hex editor, a character map, or trickery and patience, you can write these characters in any file. Or you can just copy a symbol and paste it where you want, either works.
MAKE SURE THE TARGET FILE YOU ARE WRITING/PASTING TO IS IN ANSI FORMAT, otherwise the symbol will not have the correct format and may not work as intended. See the section "How to apply all of this" below.

And here's a nifty little script you can execute in the console to see how each color shows up:
Code:
echo
echo "### LIST OF COLORS ###"
echo "Standard colors:"
echo "<€> x80 | White"
echo "<> x81 | Magenta"
echo "<‚> x82 | Yellow"
echo "<ƒ> x83 | Green"
echo "<„> x84 | Blue"
echo "<…> x85 | Red"
echo "<†> x86 | Gray"
echo "<‡> x87 | Orange"
echo
echo "Special colors:"
echo "  Code | SRB2     | Kart     | DRRR 
echo "<ˆ> x88 | Sky      | Sky      | Sky"
echo "<‰> x89 | Lavender | Lavender | Lavender"
echo "<Š> x8A | Aqua     | Gold     | Gold"
echo "<‹> x8B | Peridot  | Tea/Lime | Aqua"
echo "<Œ> x8C | Azure    | Steel    | Magenta"
echo "<> x8D | Brown    | Pink     | Pink"
echo "<Ž> x8E | Rosy     | Brown    | Brown"
echo "<> x8F | Inverted | Peach    | Tan"
echo

Remember: ANSI format, or this won't work!

Usage example:
This is a ‚yellow€ ring!



Before finally explaining how to color things, here are the colors and color codes available to you:

Colors in SRB2
Colors in SRB2Kart
Colors in Ring Racers

Colors 80 through 87 are the standard colors, usually similar across all game versions. They show up as expected in the server title.
The rest of the colors are special colors that may be different across source mods, and aren't explicitly supported in the server browser, usually turning text back to default color or truncating/blanking the title.

For caret codes, remember to replace x8 with ^.

About transparency​

You may have noticed transparency in an earlier grid. Here it is again:
srb2colorgrid.png

Every hex increment of 0x01 changes the text color, while every increment of 0x10 increases the text's transparency.

Sadly, transparency is not supported in server names, in the same way that special colors have spotty support.
On top of that, caret codes do not have space to indicate transparency.
I'm not sure if you can use special symbols in SOC though...


How to apply all of this​

Using caret codes is very simple. Just type the appropiate code in the appropiate field, and there you go. It's as easy as that! But be warned, the server name field has space for 31 characters total, and these take up 2.

If you want to use ASCII symbols instead, it's a bit more complicated: You can't type them in-game nor in the console, but you can type it in a file and execute it! Here's how I do it:

Step 1:
Create an empty text file somewhere in your SRB2 folder, and give it a short name you can remember.
filename.png

You will execute this file in SRB2, so don't make it too long.
Once you create it, open it with a text editor. I prefer Notepad++, but you can use Notepad or something else.

Step 2:
This is VERY important: Before you start adding things, make sure the encoding of the file is ANSI!
If the encoding is not ANSI, the program will end up saving color symbols in a different format, giving unintended results.

In Notepad, go to the file menu and click "Save As...", and you'll be given a prompt for a filename. Right next to the save button, you have an "Encoding" drop down menu. Select "ANSI", and save the text file.
ansin.png

(sorry for spanish UI)

In Notepad++, there's an "Encoding" menu at the top of the window. Select "ANSI". Save the file afterwards.
ansinpp.png


If you use something else for text editing, the encoding option may be somewhere else.

Once saved, we can start coloring:

Step 3:
Write your server's name, and just add the colors you want before the text you want to color.
Adding a color code will color all text after it until the game finds another color code.

For example, I want my server name to look like this:
nameexample.png

(I want "Minecraft" to be green, "but" to remain white and and "real" to be yellow)

All I have to do is open the text file and write:
Code:
servername "ƒMinecraft€ but ‚real"
The ƒ represents green, white and yellow.
(You don't have to put a white color code right after the colored word, that's just my stylistic choice.)

Once done, save the file.

Step 4:
With SRB2 open, type "exec" followed by a space and the name and extension of the file you created. Then press enter to execute it. Done!
Now check the "Host server" menu, and you'll see your new colored server name there.
And that's pretty much it!

Step Troubleshooting:

If the color doesn't work, make sure your text file is encoded in ANSI.
If the server name gets cut off, make it shorter. The server name only supports 31 characters total, and this includes color symbols.
If the server name doesn't show properly, make sure you're not using transparency.
[/spoiler]

sure ok

1) Make a text file
2) Make sure it uses the ANSI encoding
3) In it, type "servername", add a space then type your server name between quotes. Include the colors you want.
4) Save the file
5) Execute the file in SRB2

k there you go


For Lua scripting​

It's worth mentioning - You don't need to copy these symbols if you want to print colored text!
Lua can escape special characters via an escape sequence - These always begin with a backslash (\), indicating Lua that whatever's next after it will represent a character in some way.
For escaping color codes, you have two different formats:
  • One of them involve the backslash followed by up to three decimal digits forming a number between 0 to 255. You can use left zeroes to pad out anything less than three digits for readability.
    For example:
    • \065 would escape the character A.
    • \129 would escape a purple color code.
  • The second one involves an hexadecimal escape. A backslash followed by a lowercase x tells Lua the following (hexadecimal) characters are part of the sequence. Anything that doesn't conform to hexadecimal (a space or any other character) will end the sequence and will be written as expected.
    For example:
    • \x41 would escape the character A.
    • \x81 would escape a purple color code.
The whole list of hex codes for color codes is in the grid in one of the sections above. Have fun!

Final notes​

I'm not sure if the dedicated server remembers the previous server name, but in case you want the game to forcefully remember your new server name, you can always add it to your autoexec.cfg file!



And that's pretty much it.
Thanks for reading, have fun, I hope it made sense, and please use it for good, this isn't acceptable
farded.png

this hurts the man
Author
amperbee
Views
11,105
First release
Last update

Share this resource

Latest updates

  1. Rewrite!

    + added an image for DRRR colors + replaced the pastebin link in favor of just pasting the color...

Latest reviews

I come back to this post frequently to remind myself how to use certain colours, and this update is very nice! Thank you :)
Upvote 0
This "add-on" that's been around since 2021 has really helped server owners like me spice up not only their server name, but also their console prints, and other misc. HUD stuff. Thanks for making this short tutorial Amperbee. :>
Upvote 1
Very helpful and easy to follow. I've been searching the wiki for a while not knowing this topic isn't documented there, and I eventually just decided to search the MB and found this.
Upvote 0
Very helpful! This condenses info from the wiki (as well as some info not yet on the wiki?) into one convenient spot. I learned a thing or two while reading.
Upvote 2
Back
Top