ColorTools
AnsiColorString
add ANSI color codes to a string
Calling Sequence
Parameters
Description
Examples
Compatibility
AnsiColorString( s, foreground=fgcolor, background=bgcolor)
s
-
string - the string to be formatted
fgcolor
color format recognized by ColorTools, default "White"
bgcolor
color format recognized by ColorTools, default "Black"
This routine adds the ANSI escape codes to the input string so that it will be displayed with the specified foreground and background colors in environments that support ANSI escape codes. This is meant for use with the Maple command-line interface where the escape codes will not be printed, even if they are not properly supported.
The standard user interface of Maple does not support ANSI escape codes and returned strings will have the ANSI escape codes visible in them.
The output of this command will be full of weird characters in the Maple standard user interface, but should be displayed in the given colors in command-line Maple used in a terminal that supports ANSI colors.
ColorTools:-AnsiColorString⁡Hello World,foreground=Gold,background=Blue
[38;5;220m[48;5;21mHello World[49;39m
The ColorTools[AnsiColorString] command was introduced in Maple 2021.
For more information on Maple 2021 changes, see Updates in Maple 2021.
See Also
interface/ansicolor
Download Help Document