ColorMixin:WrapTextInColorCode()

From Warcraft Wiki
Jump to navigation Jump to search
These functions are implemented in :WrapTextInColorCode FrameXML/Util.lua.

Wraps a string with |cffRRGGBB and |r escape sequences.

wrappedText = WrapTextInColorCode(text, colorHexString)
wrappedText = color:WrapTextInColorCode(text)

Arguments

text
string - The text to wrap
colorHexString
string - ff followed by six hexadecimal digits as RRGGBB like the return from ColorMixin:GenerateHexColor().

Returns

wrappedText
string - |cffRRGGBBtext|r with the appropriate values inserted for RR, GG, BB and text.

Details

  • Operates as a standalone function with two arguments, or as a method of ColorMixin with one argument.

Example

print("Did someone say " .. WrapTextInColorCode("yellow", "ffffff00") .. "?")   -- Did someone say yellow?

Patch changes

References

 
  1. ^ 2016-10-25, Util.lua, version 7.1.0.22908, near line 25, archived at Townlong-Yak
  2. ^ 2016-07-19, Util.lua, version 7.0.3.22267, near line 621, archived at Townlong-Yak