colorize function

String colorize(
  1. String value,
  2. LogColor color
)

Colorizes the given value with the specified color.

Example usage:

String coloredValue = colorize('Hello', LogColor.red);
print(coloredValue); // Prints the value 'Hello' in red color.

Implementation

String colorize(String value, LogColor color) =>
    '\x1B[${_colors[color]}$value\x1B[0m';