diff options
author | red-001 <red-001@outlook.ie> | 2017-03-17 18:20:13 +0000 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-03-17 19:20:13 +0100 |
commit | d31750cb9375a961bf225ede210435751edfe7c9 (patch) | |
tree | 24f156b57f3c1a905b0422275fe99487b4fce146 /doc | |
parent | 7b74f04a611ddaf36d79c0c9ebbf7f2b89c12a64 (diff) | |
download | minetest-d31750cb9375a961bf225ede210435751edfe7c9.tar.gz minetest-d31750cb9375a961bf225ede210435751edfe7c9.tar.bz2 minetest-d31750cb9375a961bf225ede210435751edfe7c9.zip |
Give CSM access to use `core.colorize()` (#5113)
Diffstat (limited to 'doc')
-rw-r--r-- | doc/client_lua_api.md | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/doc/client_lua_api.md b/doc/client_lua_api.md index 70716ee41..5fba66c69 100644 --- a/doc/client_lua_api.md +++ b/doc/client_lua_api.md @@ -787,12 +787,12 @@ Call these functions only at load time! extra arguments and return the result * `fgettext(string, ...)` : returns string * same as fgettext_ne(), but calls core.formspec_escape before returning result -* `show_formspec(formname, formspec)` : returns true on success - * Shows a formspec to the player ### UI * `minetest.ui.minimap` * Reference to the minimap object. See `Minimap` class reference for methods. +* `show_formspec(formname, formspec)` : returns true on success + * Shows a formspec to the player Class reference --------------- @@ -837,3 +837,37 @@ Definition tables func = function(name, param), -- Called when command is run. -- Returns boolean success and text output. } + +Escape sequences +---------------- +Most text can contain escape sequences, that can for example color the text. +There are a few exceptions: tab headers, dropdowns and vertical labels can't. +The following functions provide escape sequences: +* `core.get_color_escape_sequence(color)`: + * `color` is a ColorString + * The escape sequence sets the text color to `color` +* `core.colorize(color, message)`: + * Equivalent to: + `core.get_color_escape_sequence(color) .. + message .. + core.get_color_escape_sequence("#ffffff")` +* `color.get_background_escape_sequence(color)` + * `color` is a ColorString + * The escape sequence sets the background of the whole text element to + `color`. Only defined for item descriptions and tooltips. + +`ColorString` +------------- +`#RGB` defines a color in hexadecimal format. + +`#RGBA` defines a color in hexadecimal format and alpha channel. + +`#RRGGBB` defines a color in hexadecimal format. + +`#RRGGBBAA` defines a color in hexadecimal format and alpha channel. + +Named colors are also supported and are equivalent to +[CSS Color Module Level 4](http://dev.w3.org/csswg/css-color/#named-colors). +To specify the value of the alpha channel, append `#AA` to the end of the color name +(e.g. `colorname#08`). For named colors the hexadecimal string representing the alpha +value must (always) be two hexadecima
\ No newline at end of file |