apply function
return text with ANSI format example: print('\u{1B}[31m\u{1B}[103mHello World!\u{1B}[0m');
Implementation
String apply(
String text, {
ANSIStyles? color,
ANSIStyles? bg,
ANSIStyles? fontStyle,
}) {
String rs = text;
if (color != null) {
rs = '\u{1B}[${_getStyle(color)}m' + rs;
}
if (bg != null) {
rs = '\u{1B}[${_getStyle(bg)}m' + rs;
}
if (fontStyle != null) {
rs = '\u{1B}[${_getStyle(fontStyle)}m' + rs;
}
rs = rs + '\u{1B}[0m';
return rs;
}