setAnsiSupport static method

void setAnsiSupport(
  1. bool? enabled
)

Force enable or disable ANSI color support.

Use this for:

  • Testing purposes
  • User preference override
  • Forcing colors in CI/CD environments

Pass null to reset to auto-detection.

Example:

// Force colors on
TerminalCapabilities.setAnsiSupport(true);

// Force colors off
TerminalCapabilities.setAnsiSupport(false);

// Reset to auto-detect
TerminalCapabilities.setAnsiSupport(null);

Implementation

static void setAnsiSupport(bool? enabled) {
  _supportsAnsi = enabled;
}