Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/common/color.js
Show First 20 Lines • Show All 143 Lines • ▼ Show 20 Lines | |||||
function colorizeHotkey(text, hotkey) | function colorizeHotkey(text, hotkey) | ||||
{ | { | ||||
let key = Engine.ConfigDB_GetValue("user", "hotkey." + hotkey); | let key = Engine.ConfigDB_GetValue("user", "hotkey." + hotkey); | ||||
if (!key || key.toLowerCase() == "unused") | if (!key || key.toLowerCase() == "unused") | ||||
return ""; | return ""; | ||||
return sprintf(text, { | return sprintf(text, { | ||||
"hotkey": | "hotkey": coloredText("\\[" + key + "]", g_HotkeyColor) | ||||
"[color=\"" + g_HotkeyColor + "\"]" + | |||||
"\\[" + key + "]" + | |||||
"[/color]" | |||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* The autocomplete hotkey is hardcoded in SDLK_TAB of CInput.cpp, | * The autocomplete hotkey is hardcoded in SDLK_TAB of CInput.cpp, | ||||
* as we don't want hotkeys interfering with typing text. | * as we don't want hotkeys interfering with typing text. | ||||
*/ | */ | ||||
function colorizeAutocompleteHotkey(string) | function colorizeAutocompleteHotkey(string) | ||||
{ | { | ||||
return sprintf(string || translate("Press %(hotkey)s to autocomplete playernames."), { | return sprintf(string || translate("Press %(hotkey)s to autocomplete playernames."), { | ||||
"hotkey": | "hotkey": | ||||
"[color=\"" + g_HotkeyColor + "\"]" + | coloredText("\\[" + translateWithContext("hotkey", "Tab") + "]", g_HotkeyColor) | ||||
"\\[" + translateWithContext("hotkey", "Tab") + "]" + | |||||
"[/color]" | |||||
}); | }); | ||||
} | } | ||||
/** | /** | ||||
* Adds grey font if savegame/replay is not compatible. | * Adds grey font if savegame/replay is not compatible. | ||||
*/ | */ | ||||
function compatibilityColor(text, isCompatible) | function compatibilityColor(text, isCompatible) | ||||
{ | { | ||||
return isCompatible ? text : '[color="96 96 96"]' + text + '[/color]'; | return isCompatible ? text : coloredText(text, "96 96 96"); | ||||
} | } |
Wildfire Games · Phabricator