Wowpedia
Advertisement

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

Warning Warning: If you are using the chat window or an in-game text editor, then "|" will most likely be escaped. Try using "\124" instead which is the ASCII code for the pipe character.

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

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.

|A:atlas:height:width[:offsetX:offsetY[:rVertexColor:gVertexColor:bVertexColor]]|a

Examples

  • Both slash / or escaped backslashes \\ are valid file separators.
  • Parameters that are zeros can be omitted in between :characters.
Coloring
"|cFFFF0000This is red text|r this is normal color"
WrapTextInColorCode("This is red text", "FFFF0000").." this is normal color"
This is red text this is normal color
Texture
Accepts a file path or FileDataID.
"|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[2]
"|TInterface\\Icons\\INV_Misc_Coin_01:16:16:0:0:64:64:4:60:4:60|t Coins (cropped)"
INV Misc Coin 01 crop.png Coins (cropped)
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[3]
Texture atlas
Accepts an Atlas name or ID.[4]
"|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[5]
Utility functions:

Protected strings

Also known as Kstrings - they prevent strings from being parsed. For example an addon would only see the string |Kq1|k instead of the actual displayed name.

Grammar

Korean

text|1A;B; is for Korean postpositions.[6] For example object particles - Eul 을 is used following a consonant, Reul 를 is used following a vowel.

print("라면|1을;를;") -- 라면 ramyeoneul
print("나무|1을;를;") -- 나무 namureul

French

|2 text is for French prepositions - de before a consonant and d' before a vowel. Having zero, one or multiple trailing spaces after |2 does not matter for the end result.

print("|2 fraise") -- de fraise
print("|2 avion")  -- d'avion

Russian

|3-id(text) is for the Russian declension of nouns (including proper names) which take different forms based on their usage in a sentence.[7] See also DeclineName().

print("|3-1(Кролик)") -- Кролика
print("|3-2(Кролик)") -- Кролику
print("|3-3(Кролик)") -- Кролика
print("|3-4(Кролик)") -- Кроликом
print("|3-5(Кролик)") -- Кролике

Plural

number |4singular:plural; or number |4singular:plural1:plural2; for ruRU. This assigns the singular or plural form depending on the number.

print("1 |4car:cars;")      -- 1 car
print("2 |4car:cars;")      -- 2 cars
print("3 blue |4car:cars;") -- 3 blue cars

number |7singular:plural; behaves the same as |4 but appears to only work while on certain non-english locales.

print("1 |7Million:Millionen;") -- 1 Million
print("2 |7Million:Millionen;") -- 2 Millionen

A or an

|5 text is for indefinite articles, a is used before words starting with a consonant sound, an is used before words starting with a vowel sound.

print("|5 banana") -- a banana
print("|5 apple")  -- an apple

Lowercase

|6 TEXT appears to convert only the next word to lowercase.

print("|6 HELLO WORLD") -- hello WORLD

Other

|n: Newline, if the widget supports it. Similar behavior as \n
||: Escapes the "|" character.
Any invalid escape sequences will be displayed as-is or is otherwise undefined behavior.

Patch changes

  • Shadowlands Patch 9.0.1 (2020-10-13): The |r escape sequence pops nested color sequences in-order instead of resetting the text to the default color.
  • Cataclysm Patch 4.0.1 (2010-10-12): Added the |K escape sequence (Kstrings).

See also

Advertisement