|
- function SetTextColor takes string txt, string color returns string
- //! textmacro settextcolorfunction takes color, colorcode
- if ( color == "$color$" ) then
- set color = "$colorcode$"
- endif
- //! endtextmacro
- //! runtextmacro settextcolorfunction ( "White", "|cFFFFFFFF" )
- //! runtextmacro settextcolorfunction ( "Red", "|c00ff0000" )
- //! runtextmacro settextcolorfunction ( "Blue", "|c000000ff" )
- //! runtextmacro settextcolorfunction ( "Teal", "|c0000ffff" )
- //! runtextmacro settextcolorfunction ( "Purple", "|c00800080" )
- //! runtextmacro settextcolorfunction ( "Yellow", "|c00ffff00" )
- //! runtextmacro settextcolorfunction ( "Green", "|c0000ff00" )
- //! runtextmacro settextcolorfunction ( "Pink", "|c00ff00ff" )
- //! runtextmacro settextcolorfunction ( "Gray", "|cFF808080" )
- //! runtextmacro settextcolorfunction ( "LightBlue", "|cFFC0FFFF" )
- //! runtextmacro settextcolorfunction ( "DarkGreen", "|cFF004000" )
- //! runtextmacro settextcolorfunction ( "Brown", "|cFF400000" )
- //! runtextmacro settextcolorfunction ( "Black", "|cFF000000" )
- return color + txt + "|r"
- endfunction
复制代码
注意这是vJass的代码,WE需要支持vJass才可以用。
用法举例:
local string s = SetTextColor( "Hello", "Yellow" )
call BJDebugMsg( s )
结果:
Hello
local string s = SetTextColor( "Hello", "Blue" )
call BJDebugMsg( s )
结果:
Hello |
|