Skip to main content

print_rich

Function print_rich 

pub fn print_rich(varargs: &[Variant])
Expand 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.

URL tags only support URLs wrapped by a 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 is represented with faint text but without any font change. Unsupported tags are left as-is in standard output.

[gdscript skip-lint] print_rich(“[color=green]Hello world![/color]”) # Prints “Hello world!”, in green with a bold font. [/gdscript] [csharp skip-lint] GD.PrintRich(“[color=green]Hello world![/color]”); // Prints “Hello world!”, in green with a bold font. [/csharp]

Note: 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.

Note: Output displayed in the editor supports clickable [url=address]text[/url] tags. The [url] tag’s address value is handled by shell_open when clicked.