# General - Warcraft III Color Codes in Depth

#### Xorifelse

##### I'd love to elaborate about discussions...........
Warcraft III Color Codes
Author: Themis@Azeroth
Date: Sunday, 25 January, 2009
Credits: StealthOfKing helped me a very little bit because my own calculations brought me in despair.

Introduction:
To display colors in text with Warcraft III, we wrap around the word a specific text that Warcraft III recognized and replaces it with colors.
To fully understand this, you must fully know how this works so you would never have to get help for this any time!
What I'm about to explain may come in handy in the future as well I will go into full detail.

Color:
We all know that there are 3 primary colors:
• Red
• Green
• Blue
Usually when we talk about these colors, we sum it up to RGB.

RGB:
Each primary color can be called a channel, sometimes there is a fourth channel as well call Alpha.
The Alpha channel handles transparency, and the four combined can be called "RGBA".
Each of these channels requires 1 byte so that the computer can render the entire color.

Byte:
1 byte exists of 8 bits, when we talk about bits we talk about binary code which exists of 1 and 0.
The binary code is the language the computer understands.
Below is a table on how binairy works, and how a number is calculated from it.
Since 1 byte is 8 bits, we start from right multiplying by 2.

Binary #2 has every bit set to 1 which means that 8 bits ( 1 byte ) can hold a maximum value of 255. However, you don't need any bits to create a 0, so that means the byte range is 0-255 which is 256 placeholders.
You might think, there are a lot of colors no way it can all be stored in 1 byte, and you are correct. However, we parse 1 byte to every channel meaning 256 * 256 * 256 is 16777216 different colors (24-bit), excluding the alpha channel, which would raise that number to 4294967296 which is a 32-bit color depth.

However we need a more human friendlier way to represent those 4 separate bytes because it's inconvenient for us and inefficient for the computer.
So in order to resolve both issues we need to compress each byte with a numeral system so this will reduce the cost of your computer's memory and we need to make a more friendly representation for a color code.
There are a couple of numeral systems out there, but the one mainly used for color codes is base-16 otherwise known as hexadecimal.

It is known as base-16 because it exists of 16 unique characters. Those characters are:

Hexadecimals primary use is for a friendly way to represent a binary code, however we won't be doing any binary code with Warcraft III.
What we want is to store our 4 bytes into 1 value that holds our entire color code. So why did I bring this up?

Hexadecimal color strings come in pairs of 2, because the hex range [0-15] 16 * 16 = 256.
And since RGBA wants a 4 bytes in range of 0-255 the hexadecimal system is perfect for it.
This means, 4*2 = 8 characters long for your color string. It would change RGBA to RRGGBBAA.

Lets convert a hexadecimal to a decimal.

As you can see, we managed to store values like 255 in 2 characters instead of 3 and we managed to get it all in 1 string.
An RGBA string is always 8 characters long and since we managed to chop 1 character of each 4 bytes down we spared ourselves 1 byte as well!

Color Codes:
Thought you were gonna learn only how to color a string eh, well we're getting there.
We don't have to work with binary, neither decimals but what we learned is how to create a hex string knowing what color it will create.
Now lets put it into use.

Everywhere, where ever you look a hex color string is represented as "RRGGBBAA", however we all know that the coding behind Warcraft III is terrible and some things are even incomplete!
Only in Warcraft III a hex color string is represented as "AARRGGBB".
But on top of that the alpha channel can't be rendered by Warcraft III!
We need to fill in every argument of the string including the alpha values, hilarious ain't it?!

How you can colorize a string is simple you have a begin tag "|c" and an end tag "|r".
After the "|c" you will in your AARRGGBB hex code and right after that the text you want to have colored.
Once you want to exit the color, simple add "|r" behind it.
Pretty much the same as forum BB tags, but a little different. Some examples:

• |c00FF0000This String Is ?|r RED!
• |c0000FF00This String Is ?|r GREEN!
• |c000000FFThis String Is ?|r BLUE!
• |c00FF9900This String Is ?|r ???!

This is a table of all player related data on color strings and RGB values.

Side Notes:
We used Hex only for a color string at this very moment, don't get it confused with a real hexadecimal value.
The conversion works the same, though it is an integer instead of a string.
This is however only accessible by (v)Jass, and it's done like this.
JASS:
``````function test takes nothing returns nothing
local integer i = 0xFF
local integer r = 0xF3E126
local integer h = \$FF

call DisplayTextToPlayer( GetLocalPlayer(), 0, 0, I2S( i ) ) // Display&#039;s 255.
call DisplayTextToPlayer( GetLocalPlayer(), 0, 0, I2S( r ) ) // Display&#039;s 15982886.
call DisplayTextToPlayer( GetLocalPlayer(), 0, 0, I2S( h ) ) // Display&#039;s 255.
endfunction``````

Also here is a large list of RGB color codes, giving you examples of the color. Just add the Alpha value of 00 before the code to make it work with Warcraft III.

#### Attachments

• 1.png
9.6 KB · Views: 708
• 2.png
6.8 KB · Views: 669
• 3.png
10.2 KB · Views: 697
• 4.png
10.9 KB · Views: 2,568

#### Tru_Power22

##### You can change this now in User CP.
Very in depth. Good Job.

#### Komaqtion

##### You can change this now in User CP.
Very in depth. Good Job.

Yeah !!! Thanks soo much for this !
I didn't know at all how these hexadecimals worked before XD

Thanks again, and a really good job

+Rep of course !

#### Romek

##### Super Moderator
'Lime' should be removed from the colours list.

Anyway, I skim-read this, and it's a great tutorial.
I'll let it sit around here for a few comments and opinions before I approve it.

##### Super Moderator
Very nice. I like the maths stuff "behind the numbers"

#### Xorifelse

##### I'd love to elaborate about discussions...........
I made the link there because it gives people the ability to copy data from the tables, of which I am unable to make here. Secondly, there is a higher chance I'll update the tutorial there because sadly, I never really look at the tutorials \ system here. It gives people some more reference too.

Anyways, I've shorten the link making it less visible.

#### Xorifelse

##### I'd love to elaborate about discussions...........
Bump, been a few days and I'd like some more criticism, if there of course is any.

#### Xorifelse

##### I'd love to elaborate about discussions...........
Bump, been a few days and I'd like some more criticism, if there of course is any...

#### Sevion

##### The DIY Ninja
It's too colorful :-/

#### Avaleirra

##### Is back. Probably.
Thanks! This was very useful :thup:

+rep

#### Dest

##### New Member
Why not add a new list for other colors? Like beige, dark purple, yellow-green, etc... That's your call though.

Nice tutorial.

#### Sevion

##### The DIY Ninja
This isn't just a list of colors for you to copy. It's a tutorial for a reason. It teaches you how to create colors so you aren't limited to colors in a list.

#### Dest

##### New Member
This isn't just a list of colors for you to copy. It's a tutorial for a reason. It teaches you how to create colors so you aren't limited to colors in a list.

No need to counterattack... I was just showing a suggestion.

#### Sevion

##### The DIY Ninja
It wasn't a counterattack? It was merely an explaination of what the purpose of this is.

#### Xorifelse

##### I'd love to elaborate about discussions...........
Why not add a new list for other colors? Like beige, dark purple, yellow-green, etc... That's your call though.

Nice tutorial.

No need to counterattack... I was just showing a suggestion.

As Sevion said, the purpose of this tutorial is to educate you how to generate your own colors without any outside help. If you want a yellow green color you now know you need to set the channel of green to a high number. For yellow a mixture of 2 colors is required. Those are red and green. This means you need to set green to an even higher number and a 50% of red.
This would put give you the hex value of 99FF00, resulting in this color.
For dark purple it requires a mix of red and blue. But since purple is a dark color it means that the range of this is between 0 and 9. Otherwise the color might brighten up 1 channel to much resulting in a lighter color.
So about 880099 is the right color resulting in this.

However, I've added a color list image to the tutorial might give you and some other people some insight.

#### snmiglight

##### Active Member
wow nice tutorial... very in depth

anyways, i have an easy method in

getting hex color codes without referring to tables

all you need is MSPaint and Calc.exe in scientific mode

then open MSPaint, click >> Colors >> Edit Colors >>> Define Custom Colors.

there you see a color chart and at bottom right corner you'll

see the values of RGB in decimal. now go to Calc.exe and convert the

decimal values into hexadecimal. (must be in scientific mode)

Approved

#### kaboo

##### New Member
too complicated in my opinion

#### Laiev

##### Hey Listen!!
this use hex decimal too, not only RBG

General chit-chat
Help Users
• No one is chatting at the moment.
• The Helper:
You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
• The Helper:
I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
• The Helper:
What is up Old Mountain Shadow?
• The Helper:
Happy Thursday!
+1
• Varine:
Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
• Varine:
I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
• Varine:
Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
• Varine:
So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
• Varine:
I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
• Varine:
Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
• Varine:
Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
• Ghan:
Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
• The Helper:
Power back on finally - all is good here no damage
+2
• V-SNES:
Happy Friday!
+1
• The Helper:
New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/
• The Helper:
I think we need to add something to the bottom of the front page that shows the Headline News forum that has a link to go to the News Forum Index so people can see there is more news. Do you guys see what I am saying, lets say you read all the articles on the front page and you get to the end and it just ends, no kind of link for MOAR!
• The Helper:
Happy Wednesday!
+1
• V-SNES:
Happy Friday!
+1
• The Helper:
Sticking with the desserts for now the latest recipe is Fried Apple Pies - https://www.thehelper.net/threads/recipe-fried-apple-pies.194297/
• The Helper:
Finally finding about some of the bots that are flooding the users online - bytespider apparently is a huge offender here - ignores robots.txt and comes in from a ton of different IPs

### Members online

No members online now.