bbcode_in_richtextlabel.rst 5.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. .. _doc_bbcode_in_richtextlabel:
  2. BBCode in RichTextLabel
  3. =======================
  4. Introduction
  5. ------------
  6. :ref:`class_RichTextLabel` allows the display of 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 a ``RichTextLabel`` to work properly, it must be set up. That 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. | **strikethrough** | ``[s]{text}[/s]`` | Makes {text} strikethrough. |
  27. +-------------------+--------------------------------------------+--------------------------------------------------------------+
  28. | **code** | ``[code]{text}[/code]`` | Makes {text} monospace. |
  29. +-------------------+--------------------------------------------+--------------------------------------------------------------+
  30. | **center** | ``[center]{text}[/center]`` | Makes {text} centered. |
  31. +-------------------+--------------------------------------------+--------------------------------------------------------------+
  32. | **right** | ``[right]{text}[/right]`` | Makes {text} right-aligned. |
  33. +-------------------+--------------------------------------------+--------------------------------------------------------------+
  34. | **fill** | ``[fill]{text}[/fill]`` | Makes {text} fill width. |
  35. +-------------------+--------------------------------------------+--------------------------------------------------------------+
  36. | **indent** | ``[indent]{text}[/indent]`` | Increase indent level of {text}. |
  37. +-------------------+--------------------------------------------+--------------------------------------------------------------+
  38. | **url** | ``[url]{url}[/url]`` | Show {url} as such. |
  39. +-------------------+--------------------------------------------+--------------------------------------------------------------+
  40. | **url (ref)** | ``[url=<url>]{text}[/url]`` | Makes {text} reference <url>. |
  41. +-------------------+--------------------------------------------+--------------------------------------------------------------+
  42. | **image** | ``[img]{path}[/img]`` | Insert image at resource {path}. |
  43. +-------------------+--------------------------------------------+--------------------------------------------------------------+
  44. | **font** | ``[font=<path>]{text}[/font]`` | Use custom font at <path> for {text}. |
  45. +-------------------+--------------------------------------------+--------------------------------------------------------------+
  46. | **color** | ``[color=<code/name>]{text}[/color]`` | Change {text} color; use name or # format, such as #ff00ff. |
  47. +-------------------+--------------------------------------------+--------------------------------------------------------------+
  48. Built-in color names
  49. ~~~~~~~~~~~~~~~~~~~~
  50. List of valid color names for the [color=<name>] tag:
  51. - aqua
  52. - black
  53. - blue
  54. - fuchsia
  55. - gray
  56. - green
  57. - lime
  58. - maroon
  59. - navy
  60. - purple
  61. - red
  62. - silver
  63. - teal
  64. - white
  65. - yellow
  66. Hexadecimal color codes
  67. ~~~~~~~~~~~~~~~~~~~~~~~
  68. For opaque RGB colors, any valid 6-digit hexadecimal code is supported, e.g. ``[color=#ffffff]white[/color]``.
  69. For transparent RGB colors, any 8-digit hexadecimal code can be used, e.g. ``[color=#88ffffff]translucent white[/color]``.
  70. In this case, note that the alpha channel is the **first** component of the color code, not the last one.