fillAttributes method

void fillAttributes({
  1. String? char,
  2. int? fg,
  3. int? bg,
  4. int? modifiers,
})

Fills the entire buffer with the specified attributes.

Implementation

void fillAttributes({String? char, int? fg, int? bg, int? modifiers}) {
  if (char != null) characters.fillRange(0, characters.length, char);
  if (fg != null || bg != null || modifiers != null) {
    for (var i = 0; i < characters.length; i++) {
      final idx = i * 3;
      if (fg != null) attributes[idx + 0] = fg;
      if (bg != null) attributes[idx + 1] = bg;
      if (modifiers != null) attributes[idx + 2] = modifiers;
    }
  }
}