aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2019-03-15 19:03:12 +0000
committerrubenwardy <rw@rubenwardy.com>2019-08-03 19:36:30 +0100
commitec3795a55c24685ec732fada3d1f5ba75ecd1cd5 (patch)
treec0b9dbcb480f2486c6030b7e989990a69b03d9af /doc
parentd1a1c5cbf055e7eacbc4aeaa53174749d4c64d87 (diff)
downloadminetest-ec3795a55c24685ec732fada3d1f5ba75ecd1cd5.tar.gz
minetest-ec3795a55c24685ec732fada3d1f5ba75ecd1cd5.tar.bz2
minetest-ec3795a55c24685ec732fada3d1f5ba75ecd1cd5.zip
Add style[] tag with button support
Diffstat (limited to 'doc')
-rw-r--r--doc/lua_api.txt39
1 files changed, 38 insertions, 1 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 4026821dd..bcc304584 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -1886,7 +1886,8 @@ For coloured text you can use `minetest.colorize`.
WARNING: Minetest allows you to add elements to every single formspec instance
using `player:set_formspec_prepend()`, which may be the reason backgrounds are
-appearing when you don't expect them to. See [`no_prepend[]`].
+appearing when you don't expect them to, or why things are styled differently
+to normal. See [`no_prepend[]`] and [Styling Formspecs].
Examples
--------
@@ -2353,6 +2354,20 @@ Elements
**Note**: do _not_ use a element name starting with `key_`; those names are
reserved to pass key press events to formspec!
+### `style[<name>;<propery>;<value]`
+
+Set the style for the named element `name`.
+Note: this **must** be before the element's tag.
+
+See [Styling Formspecs].
+
+
+### `style_type[<type>;<propery>;<value>]`
+
+Sets the style for all elements of type `type` which appear after this tag.
+
+See [Styling Formspecs].
+
Migrating to Real Coordinates
-----------------------------
@@ -2388,6 +2403,28 @@ offsets when migrating:
| list | | | Spacing is now 0.25 for both directions, meaning lists will be taller in height
| label | 0, +0.3 | | The first line of text is now positioned centered exactly at the position specified
+Styling Formspecs
+-----------------
+
+Formspec elements can be themed using the style tags:
+
+ style[ELEMENT_NAME;PROPERTY;VALUE]
+ style_type[ELEMENT_TYPE;PROPERTY;VALUE]
+
+For example:
+
+ style_type[button;bgcolor;#006699]
+ style[world_delete;bgcolor;#ff0000]
+ button[4,3.95;2.6,1;world_delete;Delete]
+
+### Valid Properties
+
+* button and button_exit
+ * bgcolor - sets button tint
+ * textcolor
+* tabheader
+ * bgcolor - tab background
+ * textcolor