AnsiColor.fg constructor

const AnsiColor.fg(
  1. int? fg
)

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 foreground color.

Automatically enables color output.

Implementation

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