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.)
== color ==
[[../../Optimizer#CACHE_RETURN|CACHE_RETURN]] |}
Returns the color (or style) code modifier for a given value. If the value isn't valid, white is used instead. The list of valid color names is: BLACK, DARK_BLUE, DARK_GREEN, DARK_AQUA, DARK_RED, DARK_PURPLE, GOLD, GRAY, DARK_GRAY, BLUE, GREEN, AQUA, RED, LIGHT_PURPLE, YELLOW, WHITE, RANDOM, BOLD, STRIKETHROUGH, UNDERLINE, ITALIC, or PLAIN_WHITE. Other supported values include the color integers 0-15, the color hex numbers 0-F, and the style values k, l, m, n, o, and r. 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
| color
|-
! scope="row" | Returns
| string
|-
! scope="row" | Usages
| name
|-
! scope="row" | Throws
|
|-
! scope="row" | Since
| 3.0.1
|-
! scope="row" | Restricted
| No
|-
! scope="row" | Optimizations
| [[../../Optimizer#CONSTANT_OFFLINE|CONSTANT_OFFLINE]] [[../../Optimizer#CACHE_RETURN|CACHE_RETURN]] |}
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 ===
color(name)=== Examples === Sorry, there are no examples for this function! :( ===See Also===
[[API/functions/colorize.html|colorize]]
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.)