View Single Post
02-06-24, 03:25 PM   #4
atshn
A Deviate Faerie Dragon
Join Date: Feb 2024
Posts: 19
Originally Posted by Kanegasi View Post
To clarify a little more:

Prefix is "|c" for text color. However, if you're typing, input boxes filter out UI escape sequences. Using "\124c" instead bypasses that, but not required if the print call is in an addon file. 124 is the ASCII number for the vertical bar.

Then, the color code is eight hex digits (0 to 255, so 00 to FF) in the ARGB format (alpha, red, green, and blue). Alpha is not actually utilized as far as I know, haven't tested it in years, so the first two digits are always FF for 100%.

Next is the text that will be colored, followed by an optional suffix of "|r" for "reset". It's not required, but if you want text further in the line or box to be the default color for that font object, you need to reset the color sequence. It's good practice to always include the reset suffix to prevent unintended effects where the color bleeds over if anything queries or views the contents of the font string, such as addons that mirror chat for copying or in Lua errors that include the font string.

To include this color change for the print call shown:

print("|cffffff00"..message.."|r")

More information on UI escape sequences can be found here:
https://warcraft.wiki.gg/wiki/UI_escape_sequences
That worked perfectly. Thanks for the in-depth response. Much appreciated!
  Reply With Quote