Skip to content
pubscout

ansicolor

2.0.3, released 2 years ago by mcdole.org

An xterm-256 color support library for changing terminal text colors and backgrounds.

WASM-ready
$ flutter pub add ansicolor
Source repository

What it does

Provides AnsiPen to add ANSI color codes to terminal log messages and text output. Supports setting foreground and background colors easily and globally disabling colors for production.

AI-written summary of version 2.0.3, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to colorize terminal logs or command-line outputs in Dart
  • You need xterm-256 color support for CLI tools

Skip it when

  • You are building a Flutter GUI application rather than a CLI tool
  • You need a full-featured logging framework with severity levels and formatting

Strengths

  • Simple API using AnsiPen
  • Supports xterm-256 colors and RGB coloring
  • Easy global disabling for production environments

Weaknesses

  • Relies on stdio to detect ANSI support which can sometimes be wrong
  • Limited to adding ANSI color codes

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0

No dependencies or complex setup required.

AnsiPen pen = AnsiPen()..white(bold: true);
print(pen("Bright white foreground") + " this text is default fg/bg");

Alternatives

Packages that do the same job and could replace ansicolor.

  • logger

    If you need a complete logging solution with pretty printing and log levels rather than just raw ANSI color pens.

  • mason_logger

    If you are building complex CLI tools and need advanced logging, progress indicators, and standard CLI styling.

Works with

Packages commonly used together with ansicolor: ones it builds on, ones built on it, and its own family.