summaryrefslogtreecommitdiff
path: root/doc/lua_api.txt
diff options
context:
space:
mode:
authorEkdohibs <nathanael.courant@laposte.net>2016-05-31 17:30:11 +0200
committerEkdohibs <nathanael.courant@laposte.net>2016-05-31 17:34:29 +0200
commit14ef2b445adcec770defe1abf83af9d22ccf39d8 (patch)
treebe434ea35d6134f4e7b90a74283a21815ed079ee /doc/lua_api.txt
parent1d40385d4aacf0cbea4b19ff06940e8c9bebaf47 (diff)
downloadminetest-14ef2b445adcec770defe1abf83af9d22ccf39d8.tar.gz
minetest-14ef2b445adcec770defe1abf83af9d22ccf39d8.tar.bz2
minetest-14ef2b445adcec770defe1abf83af9d22ccf39d8.zip
Add colored text (not only colored chat).
Add documentation, move files to a proper place and avoid memory leaks. Make it work with most kind of texts, and allow backgrounds too.
Diffstat (limited to 'doc/lua_api.txt')
-rw-r--r--doc/lua_api.txt18
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 82a0acbee..aa0d7e45d 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -1701,6 +1701,24 @@ numerical form, the raw integer value of an ARGB8 quad:
or string form, a ColorString (defined above):
`colorspec = "green"`
+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.
+
Spatial Vectors
---------------
* `vector.new(a[, b, c])`: returns a vector: