wrapWith static method
Wraps text with provided styles.
Implementation
static String wrapWith(
String text, {
AnsiColor? background,
AnsiColor? foreground,
AnsiColor? bright,
bool? reverse,
bool? underline,
}) {
var retString = text;
if (reverse ?? false) {
// if reverse and background/foreground are specified we should reverse their colors
if (background != null || foreground != null || bright != null) {
final tmp = background;
background = foreground ?? bright;
foreground = tmp;
} else {
retString = _wrapAnsi(retString, _reverseType);
}
}
if (underline ?? false) {
retString = _wrapAnsi(retString, _underlineType);
}
if (foreground != null) {
retString = _wrapSingle(retString, foreground: foreground);
}
if (background != null) {
retString = _wrapSingle(retString, background: background);
}
if (bright != null) {
retString = _wrapSingle(retString, bright: bright);
}
return retString;
}