bbcode_in_richtextlabel.rst 4.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. .. _doc_bbcode_in_richtextlabel:
  2. BBCode in RichTextLabel
  3. =======================
  4. Introduction
  5. ------------
  6. :ref:`class_RichTextLabel` allows to display complex text markup in a control.
  7. It has a built-in API for generating the markup, but can also parse a BBCode.
  8. Note that the BBCode tags can also be used to some extent in the
  9. :ref:`XML source of the class reference <doc_updating_the_class_reference>`.
  10. Setting up
  11. ----------
  12. For RichTextLabel to work properly, it must be set up. This means loading
  13. the intended fonts in the relevant properties:
  14. .. image:: img/rtl_setup.png
  15. Reference
  16. ---------
  17. +-----------------+--------------------------------------------+--------------------------------------------------------------+
  18. | Command | Tag | Description |
  19. +-----------------+--------------------------------------------+--------------------------------------------------------------+
  20. | **bold** | ``[b]{text}[/b]`` | Makes {text} bold. |
  21. +-----------------+--------------------------------------------+--------------------------------------------------------------+
  22. | **italics** | ``[i]{text}[/i]`` | Makes {text} italics. |
  23. +-----------------+--------------------------------------------+--------------------------------------------------------------+
  24. | **underline** | ``[u]{text}[/u]`` | Makes {text} underline. |
  25. +-----------------+--------------------------------------------+--------------------------------------------------------------+
  26. | **code** | ``[code]{text}[/code]`` | Makes {text} monospace. |
  27. +-----------------+--------------------------------------------+--------------------------------------------------------------+
  28. | **center** | ``[center]{text}[/center]`` | Makes {text} centered. |
  29. +-----------------+--------------------------------------------+--------------------------------------------------------------+
  30. | **right** | ``[right]{text}[/right]`` | Makes {text} right-aligned. |
  31. +-----------------+--------------------------------------------+--------------------------------------------------------------+
  32. | **fill** | ``[fill]{text}[/fill]`` | Makes {text} fill width. |
  33. +-----------------+--------------------------------------------+--------------------------------------------------------------+
  34. | **indent** | ``[indent]{text}[/indent]`` | Increase indent level of {text}. |
  35. +-----------------+--------------------------------------------+--------------------------------------------------------------+
  36. | **url** | ``[url]{url}[/url]`` | Show {url} as such. |
  37. +-----------------+--------------------------------------------+--------------------------------------------------------------+
  38. | **url (ref)** | ``[url=<url>]{text}[/url]`` | Makes {text} reference <url>. |
  39. +-----------------+--------------------------------------------+--------------------------------------------------------------+
  40. | **image** | ``[img]{path}[/img]`` | Insert image at resource {path}. |
  41. +-----------------+--------------------------------------------+--------------------------------------------------------------+
  42. | **font** | ``[font=<path>]{text}[/font]`` | Use custom font at <path> for {text}. |
  43. +-----------------+--------------------------------------------+--------------------------------------------------------------+
  44. | **color** | ``[color=<code/name>]{text}[/color]`` | Change {text} color, use # format such as #ff00ff or name. |
  45. +-----------------+--------------------------------------------+--------------------------------------------------------------+
  46. Built-in color names
  47. ~~~~~~~~~~~~~~~~~~~~
  48. List of valid color names for the [color=<name>] tag:
  49. - aqua
  50. - black
  51. - blue
  52. - fuchsia
  53. - gray
  54. - green
  55. - lime
  56. - maroon
  57. - navy
  58. - purple
  59. - red
  60. - silver
  61. - teal
  62. - white
  63. - yellow
  64. Hexadecimal color codes
  65. ~~~~~~~~~~~~~~~~~~~~~~~
  66. For opaque RGB colors, any valid 6-digit hexadecimal code is supported, e.g. ``[color=#ffffff]white[/color]``.
  67. For transparent RGB colors, any 8-digit hexadecimal code can be used, e.g. ``[color=#88ffffff]translucent white[/color]``.
  68. In this case, note that the alpha channel is the **first** component of the color code, not the last one.