AnsiColor constructor
A utility class to apply ANSI terminal color codes to strings.
This is useful for enhancing log output or command-line interfaces with colored messages for better readability and severity-level distinction.
It supports both foreground and background color settings using ANSI 256-color codes.
Example usage:
final color = AnsiColor.fg(34); // Bright blue text
print(color('This text is blue'));
Creates an AnsiColor with optional background and foreground colors.
Set color
to true
to enable color output.
Implementation
const AnsiColor({this.bg, this.fg, this.color = false});