Your wiki has been migrated to a new Fandom domain. Learn more here.

UI escape sequences

Many UI elements that display text on the screen support a special escape sequences starting with the | pipe character.

Icon-warning-22x22.png Warning: If you are using the chat window or an in-game text editor, then "|" will most likely be replaced with "||". Try using "\124" instead of "|". 124 is the ASCII code escape for the pipe character, and will work regardless of what the editor is trying to do.

Escape Sequences

Coloring

|cAARRGGBBtext|r
  • Each pair of digits represents a color value (plus the alpha value, however the alpha value is currently ignored and should always be FF) as a hexadecimal number. The |r escape sequence pops nested color sequences in-order[1].
/run print("this is \124cFFFF0000red and \124cFF00FF00this is green\124r back to red\124r back to white")
> this is red and this is green back to red back to white

Classic

WoW Icon update.png Patch 1.13.2 (2019-08-26): The |r escape sequence resets the text to the default color instead of popping nested colors in-order.

/run print("this is \124cFFFF0000red and \124cFF00FF00this is green\124r back to white")
> this is red and this is green back to white

Textures

|Tpath:height[:width[:offsetX:offsetY:[textureWidth:textureHeight:leftTexel:rightTexel:topTexel:bottomTexel[:rVertexColor:gVertexColor:bVertexColor]]]]|t
Will insert a texture into a font string. Parameter width is optional (see below). The offsets are optional and will shift the texture from where it would normally be placed. TextHeight is based on size of the font used - this is used to automatically scale icons based on the size of the text.
  • height == 0; width omitted: Width = Height = TextHeight (always square!)
  • height > 0;  width omitted: Width = Height = height (always square!)
  • height == 0; width == 0   : Width = Height = TextHeight (always square!)
  • height > 0;  width == 0   : Width = TextHeight; Height = height (height is height!!!)
  • height == 0; width > 0    : Width = width * TextHeight; Height = TextHeight (width is an aspect ratio and defines width!!!)
  • height > 0;  width > 0    : Width = width; Height = height
  • offsetX offsetY: Offset for the rendered image, in pixels
  • textureWidth textureHeight: Size of the source image, in pixels
  • leftTexel rightTexel topTexel bottomTexel: (x1 x2 y1 y2) Coordinates that identify the left/right/top/bottom edges, in pixels (see Texture:SetTexCoord() but non-normalized)
  • rVertexColor gVertexColor bVertexColor: RGB color values in the range 0-255 that are used to tint the texture
Notes:
  • When you need to display a square icon in the string (spell/item icon), use only |Tpath:0|t
  • When you need to display a rectangular image in the string (Blizzard logo), use aspect ratio version: |Tpath:0:aspectRatio|t

Texture atlas

Main article: AtlasID

Atlases allow for easily getting part of a texture without having to use tex coords.

|Aatlas:height:width[:offsetX:offsetY]|a

Examples

Coloring
"|cFFFF0000This is red text|r this is normal color"
WrapTextInColorCode("This is red text", "FFFF0000")
This is red text this is normal color
Texture
The file path or FileDataID can be used. Both slash / or escaped backslashes \\ are valid file separators.
"|T133784:16|t Coins"
"|TInterface\\Icons\\INV_Misc_Coin_01:16|t Coins"
CreateTextureMarkup("Interface/Icons/INV_Misc_Coin_01", 64, 64, 16, 16, 0, 1, 0, 1)
Inv misc coin 01.png Coins[1]
Sets the vertex color of the texture to green (73:177:73).
"|TInterface\\ChatFrame\\UI-ChatIcon-ArmoryChat:14:14:0:0:16:16:0:16:0:16:73:177:73|t Reckful"
RemoteChat Icon.png Reckful[2]
Texture atlas
The Atlas name or ID can be used.[3] Parameters can be omitted in between colon characters.
"|A:4259:19:19|a Tank"
"|A:groupfinder-icon-role-large-tank:19:19|a Tank"
"|Tinterface\\lfgframe\\groupfinder:19:19:::1024:1024:915:944:785:814|t Tank"
CreateAtlasMarkup("groupfinder-icon-role-large-tank", 16, 16)
Atlas groupfinder-icon-role-large-tank.png Tank[4]
Utility functions:

Protected strings

Also known as Kstrings, they prevent strings from being parsed in addons.

  • Battle.net
The q variant e.g. |Kq1|k is used for the confidentiality of Battle.net account names. The number represents the Battle.net friend ID.
Known sources: C_BattleNet.GetAccountInfoByID()
  • Group Finder
The r variant e.g. |Kr14|k is used for the name and comment in group finder listings to prevent addons like World Quest Group Finder.
Known sources: C_LFGList.GetSearchResultInfo() and C_LFGList.GetActiveEntryInfo()
  • Communities
The v variant e.g. |Kv1|k is used for Community Channels to prevent addons from using it as a shared, persistent data storage. The number represents a chat message line ID.
Known sources: CHAT_MSG_COMMUNITIES_CHANNEL

Grammar

number |1singular;plural;
Will choose a word depending on whether the digit preceding it is 0/1 or not (i.e. 1,11,21 return the first string, as will 0,10,40). Note that unlike |4 singular and plural forms are separated by semi-colon.
|2text
Before vowels outputs d' (with apostrophe) and removes any leading spaces from text, otherwise outputs de (with trailing space)
|3-formid(text)
Displays text declined to the specified form (index ranges from 1 to GetNumDeclensionSets()). Processed by C code, data used for parsing isn't available to UI, all events fire with the data already processed.
number |4singular:plural; -or- number |4singular:plural1:plural2;
Will choose a form based on the number preceding it. Client locale dependant. More than two forms (separated by colons) may be required by some locales (i.e. Russian requires 3 forms), if too many forms provided they are ignored, if needed form isn't provided empty string will be used instead. Note that unlike |1 singular and plural forms are separated by colon. (added with 2.4.2)

Other

|n
Newline, if the widget supports it. Similar behavior as \n
||
Escapes the "|" character.
|
"|" followed by something that is not a valid escape sequence will be displayed as-is or is otherwise undefined behavior.

References

Community content is available under CC BY-SA 3.0 unless otherwise noted.