Changing the color of print(message)?
Is it possible to change the color of the message printed? I'd prefer yellow over the default white.
Code:
local function OnEvent(self, event, errorType, message, lineID) |
I googled around and this familiar note turned up. Not sure if it still works, but theoretically it shouldn't have needed to be changed with their api changes.
print("\124cffFF0000This text is red\124r") --This is red color Prefix = "\124" == HexColor RRGGBB == Your text Suffix = "\124r" |
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 |
Quote:
|
Quote:
|
Ah yes, the |c was more familiar rofl.
Glad you got it all sorted though :) |
All times are GMT -6. The time now is 03:30 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI