call method

String call(
  1. String msg
)

Applies the ANSI color codes to the provided msg and resets formatting after.

If color is false, the original message is returned unmodified.

Example:

final red = AnsiColor.fg(9);
print(red('Error!')); // Prints in red

Implementation

String call(String msg) {
  if (color) {
    return '$this$msg$ansiDefault';
  } else {
    return msg;
  }
}