Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/mod/gui/common/guitags.js
/** | /** | ||||
* Add color to text string. | * Add color to text string. | ||||
*/ | */ | ||||
function coloredText(text, color) | function coloredText(text, color) | ||||
{ | { | ||||
return '[color="' + color + '"]' + text + '[/color]'; | return '[color="' + color + '"]' + text + '[/color]'; | ||||
} | } | ||||
//TODO: font setter | /** | ||||
* Set GUI tags on text string. | |||||
* | |||||
* @param {string} string - String to apply tags to. | |||||
* @param {object} tags - Object containing the tags, for instance { "color": "white" } or { "font": "sans-13" }. | |||||
*/ | |||||
function setStringTags(text, tags) | |||||
{ | |||||
let result = ""; | |||||
for (let tag in tags) | |||||
result = '[' + tag + '="' + tags[tag] + '"]' + text + '[/' + tag + ']'; | |||||
return result; | |||||
} |
Wildfire Games · Phabricator