From 0d19e81009b49f752e733f44c6fb298f4a043cdd Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 29 Nov 2024 01:51:44 +0100 Subject: [PATCH] Document `print_rich()` in BBCode in RichTextLabel While `print_rich()` works independently of RichTextLabel, it still makes use of BBCode. --- tutorials/ui/bbcode_in_richtextlabel.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tutorials/ui/bbcode_in_richtextlabel.rst b/tutorials/ui/bbcode_in_richtextlabel.rst index 24b1a4c93c10..5b3d742c9158 100644 --- a/tutorials/ui/bbcode_in_richtextlabel.rst +++ b/tutorials/ui/bbcode_in_richtextlabel.rst @@ -1147,3 +1147,24 @@ This will add a few new BBCode commands, which can be used like so: [center][ghost]This is a custom [matrix]effect[/matrix][/ghost] made in [pulse freq=5.0 height=2.0][pulse color=#00FFAA freq=2.0]GDScript[/pulse][/pulse].[/center] + +Printing rich text to the console +--------------------------------- + +Using :ref:`print_rich`, you can print +rich text to the editor Output panel and standard output (visible when the user +runs the project from a terminal). This uses conversion to ANSI color codes. + +In the editor output, all BBCode tags are recognized as usual. In the terminal +output, only a subset of BBCode tags will work, as documented in the linked +``print_rich()`` method description above. In the terminal, the colors will look +different depending on the user's theme, while colors in the editor will use the +same colors as they would in the project. + +.. note:: + + To print error and warning messages that can be filtered by type in the + editor Output panel, use + :ref:`@GlobalScope.push_error` and + :ref:`@GlobalScope.push_warning` + instead of ``print_rich()``.