diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2023-04-16 16:28:30 +0200 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2023-04-24 17:03:57 +0200 |
commit | 83c39632352c0a65d9297ebbb47dd76a28ec1bdf (patch) | |
tree | 9651ee6dfa07c297aa399880d088e64273f838ce /doc | |
parent | 13cfbe6a256ef156c39a70974f01e1388629711f (diff) |
Improve `print_rich()` documentation
- List all supported colors.
- Mention URL tag support limitations.
- Fix and tweak code example to do what it says.
- Remove outdated notice about lack of Windows support (but mention
that only Windows 10 and later support ANSI code conversion).
(cherry picked from commit ec277d804e381b3bc5d44b88050e522c727ed505)
Diffstat (limited to 'doc')
-rw-r--r-- | doc/classes/@GlobalScope.xml | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 12b5493589..73f1fe9ad6 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -826,17 +826,21 @@ </method> <method name="print_rich" qualifiers="vararg"> <description> - Converts one or more arguments of any type to string in the best way possible and prints them to the console. The following BBCode tags are supported: b, i, u, s, indent, code, url, center, right, color, bgcolor, fgcolor. Color tags only support named colors such as [code]red[/code], [i]not[/i] hexadecimal color codes. Unsupported tags will be left as-is in standard output. - When printing to standard output, the supported subset of BBCode is converted to ANSI escape codes for the terminal emulator to display. Displaying ANSI escape codes is currently only supported on Linux and macOS. Support for ANSI escape codes may vary across terminal emulators, especially for italic and strikethrough. + Converts one or more arguments of any type to string in the best way possible and prints them to the console. + The following BBCode tags are supported: [code]b[/code], [code]i[/code], [code]u[/code], [code]s[/code], [code]indent[/code], [code]code[/code], [code]url[/code], [code]center[/code], [code]right[/code], [code]color[/code], [code]bgcolor[/code], [code]fgcolor[/code]. + Color tags only support the following named colors: [code]black[/code], [code]red[/code], [code]green[/code], [code]yellow[/code], [code]blue[/code], [code]magenta[/code], [code]pink[/code], [code]purple[/code], [code]cyan[/code], [code]white[/code], [code]orange[/code], [code]gray[/code]. Hexadecimal color codes are not supported. + URL tags only support URLs wrapped by an URL tag, not URLs with a different title. + When printing to standard output, the supported subset of BBCode is converted to ANSI escape codes for the terminal emulator to display. Support for ANSI escape codes varies across terminal emulators, especially for italic and strikethrough. In standard output, [code]code[/code] is represented with faint text but without any font change. Unsupported tags are left as-is in standard output. [codeblocks] [gdscript] - print_rich("[code][b]Hello world![/b][/code]") # Prints out: [b]Hello world![/b] + print_rich("[color=green][b]Hello world![/b][/color]") # Prints out "Hello world!" in green with a bold font [/gdscript] [csharp] - GD.PrintRich("[code][b]Hello world![/b][/code]"); // Prints out: [b]Hello world![/b] + GD.PrintRich("[color=green][b]Hello world![/b][/color]"); // Prints out "Hello world!" in green with a bold font [/csharp] [/codeblocks] [b]Note:[/b] Consider using [method push_error] and [method push_warning] to print error and warning messages instead of [method print] or [method print_rich]. This distinguishes them from print messages used for debugging purposes, while also displaying a stack trace when an error or warning is printed. + [b]Note:[/b] On Windows, only Windows 10 and later correctly displays ANSI escape codes in standard output. </description> </method> <method name="print_verbose" qualifiers="vararg"> |