@@ -1884,7 +1884,10 @@ When displaying text which can contain formspec code, e.g. text set by a player,
1884
1884
use `minetest.formspec_escape`.
1885
1885
For coloured text you can use `minetest.colorize`.
1886
1886
1887
- WARNING: Minetest allows you to add elements to every single formspec instance
1887
+ **WARNING**: do _not_ use a element name starting with `key_`; those names are
1888
+ reserved to pass key press events to formspec!
1889
+
1890
+ **WARNING**: Minetest allows you to add elements to every single formspec instance
1888
1891
using `player:set_formspec_prepend()`, which may be the reason backgrounds are
1889
1892
appearing when you don't expect them to, or why things are styled differently
1890
1893
to normal. See [`no_prepend[]`] and [Styling Formspecs].
@@ -2351,22 +2354,17 @@ Elements
2351
2354
* `span=<value>`: number of following columns to affect
2352
2355
(default: infinite).
2353
2356
2354
- **Note**: do _not_ use a element name starting with `key_`; those names are
2355
- reserved to pass key press events to formspec!
2356
-
2357
- ### `style[<name>;<propery>;<value]`
2357
+ ### `style[<name>;<prop1>;<prop2>;...]`
2358
2358
2359
- Set the style for the named element `name`.
2360
- Note: this **must** be before the element's tag.
2359
+ * Set the style for the named element `name`.
2360
+ * Note: this **must** be before the element is defined.
2361
+ * See [Styling Formspecs].
2361
2362
2362
- See [Styling Formspecs].
2363
2363
2364
+ ### `style_type[<type>;<prop1>;<prop2>;...]`
2364
2365
2365
- ### `style_type[<type>;<propery>;<value>]`
2366
-
2367
- Sets the style for all elements of type `type` which appear after this tag.
2368
-
2369
- See [Styling Formspecs].
2366
+ * Sets the style for all elements of type `type` which appear after this element.
2367
+ * See [Styling Formspecs].
2370
2368
2371
2369
Migrating to Real Coordinates
2372
2370
-----------------------------
@@ -2406,27 +2404,82 @@ offsets when migrating:
2406
2404
Styling Formspecs
2407
2405
-----------------
2408
2406
2409
- Formspec elements can be themed using the style tags:
2407
+ Formspec elements can be themed using the style elements:
2408
+
2409
+ style[<name>;<prop1>;<prop2>;...]
2410
+ style_type[<type>;<prop1>;<prop2>;...]
2411
+
2412
+ Where a prop is:
2410
2413
2411
- style[ELEMENT_NAME;PROPERTY;VALUE]
2412
- style_type[ELEMENT_TYPE;PROPERTY;VALUE]
2414
+ property_name=property_value
2413
2415
2414
2416
For example:
2415
2417
2416
- style_type[button;bgcolor; #006699]
2417
- style[world_delete;bgcolor;#ff0000 ]
2418
- button[4,3.95;2.6,1;world_delete;Delete]
2418
+ style_type[button;bgcolor= #006699]
2419
+ style[world_delete;bgcolor=red;textcolor=yellow ]
2420
+ button[4,3.95;2.6,1;world_delete;Delete]
2419
2421
2420
- ### Valid Properties
2422
+ Setting a property to nothing will reset it to the default value. For example:
2423
+
2424
+ style_type[button;bgimg=button.png;bgimg_pressed=button_pressed.png;border=false]
2425
+ style[btn_exit;bgimg=;bgimg_pressed=;border=;bgcolor=red]
2426
+
2427
+
2428
+ ### Supported Element Types
2421
2429
2422
- * button and button_exit
2423
- * bgcolor - sets button tint
2424
- * textcolor
2430
+ Some types may inherit styles from parent types.
2431
+
2432
+ * button
2433
+ * button_exit, inherits from button
2434
+ * checkbox
2435
+ * scrollbar
2436
+ * table
2437
+ * textlist
2438
+ * dropdown
2439
+ * field
2440
+ * pwdfield, inherits from field
2441
+ * textarea
2442
+ * label
2443
+ * vertlabel, inherits from field
2444
+ * image_button
2445
+ * item_image_button, inherits from image_button
2425
2446
* tabheader
2426
- * bgcolor - tab background
2427
- * textcolor
2428
2447
2429
2448
2449
+ ### Valid Properties
2450
+
2451
+ * button, button_exit
2452
+ * bgcolor - color, sets button tint
2453
+ * textcolor - color, default white
2454
+ * border - boolean, draw border. Set to false to hide the bevelled button pane. Default true.
2455
+ * noclip - boolean, set to true to allow the element to exceed formspec bounds.
2456
+ * bgimg - standard image. Defaults to none.
2457
+ * bgimg_pressed - image when pressed. Defaults to bgimg when not provided.
2458
+ * alpha - boolean, whether to draw alpha in bgimg. Default true.
2459
+ * checkbox
2460
+ * noclip - boolean, set to true to allow the element to exceed formspec bounds.
2461
+ * scrollbar
2462
+ * noclip - boolean, set to true to allow the element to exceed formspec bounds.
2463
+ * table, textlist
2464
+ * noclip - boolean, set to true to allow the element to exceed formspec bounds.
2465
+ * dropdown
2466
+ * noclip - boolean, set to true to allow the element to exceed formspec bounds.
2467
+ * field, pwdfield, textarea
2468
+ * noclip - boolean, set to true to allow the element to exceed formspec bounds.
2469
+ * border - set to false to hide the textbox background and border. Default true.
2470
+ * textcolor - color. Default white.
2471
+ * label, vertlabel
2472
+ * bgcolor - color. Default unset.
2473
+ * textcolor - color. Default white.
2474
+ * noclip - boolean, set to true to allow the element to exceed formspec bounds.
2475
+ * border - boolean, set to true to get a border. Default true.
2476
+ * image_button, item_image_button
2477
+ * noclip - boolean, set to true to allow the element to exceed formspec bounds.
2478
+ * border - boolean, draw border. Set to false to hide the bevelled button pane. Default false.
2479
+ * alpha - boolean, whether to draw alpha in bgimg. Default true.
2480
+ * tabheader
2481
+ * noclip - boolean, set to true to allow the element to exceed formspec bounds.
2482
+ * textcolor - color. Default white.
2430
2483
2431
2484
Inventory
2432
2485
=========
0 commit comments