# Text With Color
Grammar — Text text with color color
Flags —Native
|Function
Encloses the text with a color formatting tag so it will use the given color.
# Arguments
text
— Textcolor
— Color
Returns — text
native text TextWithColor(text t, color c);
# Related
Category: String / Formatting
- Convert Time To Text —
text
— TextTimeFormat - Convert String Case —
string
— StringCase - Convert Text Case —
text
— TextCase - Convert Game Text —
text
— StringExternal - Convert Game Hotkey —
text
— StringExternalHotkey - Convert Game Asset —
text
— StringExternalAsset - Text With Color —
text
— TextWithColor - Set Text Expression Token —
void
— TextExpressionSetToken - Text Expression —
text
— TextExpressionAssemble
# Examples
mods/liberty.sc2mod — base.sc2data/TriggerLibs/LibertyLib.galaxy:335
DialogControlCreate(DialogLastCreated(), c_triggerControlTypeLabel);
libLbty_gv_meleeSurrender_Title[lp_player] = DialogControlLastCreated();
libNtve_gf_SetDialogItemText(DialogControlLastCreated(), (TextWithColor(PlayerName(lp_player), libNtve_gf_ConvertPlayerColorToColor(PlayerGetColorIndex(lp_player, false))) + StringExternal("Param/Value/lib_Lbty_1D191C56")), PlayerGroupAll());
DialogControlSetSize(DialogControlLastCreated(), PlayerGroupAll(), 360, 50);
libNtve_gf_SetDialogItemStyle(DialogControlLastCreated(), "AISurrenderTitle", PlayerGroupAll());
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:9418
if ((TimerGetRemaining(DataTableGetTimer(true, libCOMI_gf_CM_ObjectiveTimer(lp_objective))) > 0.0)) {
if ((TimerGetRemaining(DataTableGetTimer(true, libCOMI_gf_CM_ObjectiveTimer(lp_objective))) <= DataTableGetInt(true, (libCOMI_gf_CM_ObjectiveTimer(lp_objective) + "_" + libCOMI_ge_ObjectiveTimerThresholds_Ident(libCOMI_ge_ObjectiveTimerThresholds_Red))))) {
lv_name = TextReplaceWord(lv_name, StringExternal("Param/Value/lib_COMI_251B217F"), TextWithColor(TextTimeFormat(StringToText("<mintotal/>:<sec2/>"), FixedToInt(TimerGetRemaining(DataTableGetTimer(true, libCOMI_gf_CM_ObjectiveTimer(lp_objective))))), Color(100.00, 0.00, 0.00)), c_stringReplaceAll, c_stringCase);
}
else {
mods/starcoop/starcoop.sc2mod — base.sc2data/LibCOMI.galaxy:9422
else {
if ((TimerGetRemaining(DataTableGetTimer(true, libCOMI_gf_CM_ObjectiveTimer(lp_objective))) <= DataTableGetInt(true, (libCOMI_gf_CM_ObjectiveTimer(lp_objective) + "_" + libCOMI_ge_ObjectiveTimerThresholds_Ident(libCOMI_ge_ObjectiveTimerThresholds_Yellow))))) {
lv_name = TextReplaceWord(lv_name, StringExternal("Param/Value/lib_COMI_A59236C2"), TextWithColor(TextTimeFormat(StringToText("<mintotal/>:<sec2/>"), FixedToInt(TimerGetRemaining(DataTableGetTimer(true, libCOMI_gf_CM_ObjectiveTimer(lp_objective))))), Color(100.00, 100.00, 0.00)), c_stringReplaceAll, c_stringCase);
}
else {
mods/warcoop/warclassic.sc2mod — base.sc2data/TriggerLibs/WarClassic.galaxy:1069
lv_name = StringExternal(("Name/" + (lv_uT)));
lv_level = UnitLevel(lv_u);
TextExpressionSetToken("Param/Expression/lib_GAw3_EE11EABC", "Prop", TextWithColor(lv_prop, lv_color));
TextExpressionSetToken("Param/Expression/lib_GAw3_EE11EABC", "Name", lv_name);
TextExpressionSetToken("Param/Expression/lib_GAw3_EE11EABC", "Level", IntToText(lv_level));