xterm method

AnsiPen xterm(
  1. int color, {
  2. bool bg = false,
})

Directly index the xterm 256 color palette. Compatible with ansicolor's AnsiPen.xterm() signature.

Implementation

AnsiPen xterm(int color, {bool bg = false}) {
  final int code = color < 0
      ? 0
      : color > 255
      ? 255
      : color;
  styleStack.add(
    bg ? QuectoColors.bgAnsi256(code) : QuectoColors.ansi256(code),
  );
  return this;
}