ansiColorizer function

String ansiColorizer({
  1. required Color color,
  2. required String message,
  3. AnsiPen? ansiPen,
})

Creates an ansi-compatable colored message from the color provided.

Implementation

String ansiColorizer({
  required Color color,
  required String message,
  AnsiPen? ansiPen,
}) {
  final pen = (ansiPen ?? _ansiPen)
    ..rgb(
      r: color.red / 255,
      g: color.green / 255,
      b: color.blue / 255,
    );
  return pen.write(message);
}