down property

String get down

Returns the ANSI escape codes that open the pen's current styles. Compatible with ansicolor's pen.down / '${pen}' usage.

Implementation

String get down {
  if (ansiColorDisabled || styleStack.isEmpty) return '';
  // Apply stylers to a sentinel, extract the open codes (everything before it).
  const sentinel = '\x00';
  String result = sentinel;
  for (int i = styleStack.length - 1; i >= 0; i--) {
    result = styleStack[i](result);
  }
  final idx = result.indexOf(sentinel);
  return idx >= 0 ? result.substring(0, idx) : result;
}