You are viewing an older version of the site. Click here to view
the latest version of this page. (This may be a dead link, if so, try the root page of the docs
here.)
== colorize ==
Replaces all the colorizable character codes in the string. For instance, colorize('&aText') would be equivalent to (color('a').'Text'). By default, the symbol is '&', but that can be any arbitrary string that you specify. If text is not a string, that value is simply returned. If you need to "escape" a symbol, (that is have a literal symbol followed by a letter that is a valid color) just repeat the symbol twice, for instance '&&c' would return a literal '&c' instead of a red modifier. Additionally, any RGB color can be used in the hex format 'rrggbb' (except in tellraw).
=== Vital Info ===
{| style="width: 40%;" cellspacing="1" cellpadding="1" border="1" class="wikitable"
|-
! scope="col" width="20%" |
! scope="col" width="80%" |
|-
! scope="row" | Name
| colorize
|-
! scope="row" | Returns
| mixed
|-
! scope="row" | Usages
| text, [symbol]
|-
! scope="row" | Throws
|
|-
! scope="row" | Since
| 3.3.1
|-
! scope="row" | Restricted
| No
|-
! scope="row" | Optimizations
| [[../../Optimizer#CONSTANT_OFFLINE|CONSTANT_OFFLINE]]
|}Since the vanilla Minecraft client does not support RGB color codes, these are translated to json text components by the server when passed to messaging functions. As such, these are not directly supported in tellraw functions or commands. Instead, the color must be manually specified under the 'color' key of the json text component.
=== Usages ===
colorize(text, [symbol])=== Examples === Sorry, there are no examples for this function! :( ===See Also===
[[API/functions/color.html|color]]
Find a bug in this page? Edit this page yourself, then submit a pull request. (Note this page is automatically generated from the documentation in the source code.)