setTextColor static method

void setTextColor(
  1. int id, {
  2. bool xterm = false,
  3. bool bright = false,
})

Sets the Current Text Color.

Implementation

static void setTextColor(int id, {bool xterm = false, bool bright = false}) {
  Color color;
  if (xterm) {
    var c = id.clamp(0, 256);
    color = Color(c, xterm: true);
    sgr(38, [5, c]);
  } else {
    color = Color(id, bright: true);
    if (bright) {
      sgr(30 + id, [1]);
    } else {
      sgr(30 + id);
    }
  }
  _currentTextColor = color;
}