AnsiColor.bg constructor

const AnsiColor.bg(
  1. int? bg
)

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 only a background color.

Automatically enables color output.

Implementation

const AnsiColor.bg(this.bg)
    : fg = null,
      color = true;