AnsiColorString - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


ColorTools

  

AnsiColorString

  

add ANSI color codes to a string

 

Calling Sequence

Parameters

Description

Examples

Compatibility

Calling Sequence

AnsiColorString( s, foreground=fgcolor, background=bgcolor)

Parameters

s

-

string - the string to be formatted

fgcolor

-

color format recognized by ColorTools, default "White"

bgcolor

-

color format recognized by ColorTools, default "Black"

Description

• 

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.

Examples

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:-AnsiColorStringHello World,foreground=Gold,background=Blue

[38;5;220m[48;5;21mHello World[49;39m

(1)

Compatibility

• 

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