ansicolor 1.1.1
ansicolor: ^1.1.1
ansicolor: ^2.0.0-nullsafety.0

Dart native js
Flutter Android iOS web

Looking to add some color to your terminal logs? `ansicolor` is an xterm-256 color support library that lets you change the foreground and background color of your text.

ANSI / Xterm 256 color library for Dart #

Feel like you're missing some color in your terminal programs? Use AnsiPen to add ANSI color codes to your log messages.

Easy to disable for production, just set color_disabled = true and all codes will be empty - no re-writing debug messages.

Note: color_disabled is a global variable for all pen colors.

Example #

Note: Be mindful of contrasting colors. If you set "bright white" foreground and don't adjust the background, you'll have a bad time with lighter terminals.

Foreground to bright white with default background:

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

Background as a peach, foreground as white:

AnsiPen pen = new AnsiPen()..white()..rgb(r: 1.0, g: 0.8, b: 0.2);
print(pen("White foreground with a peach background"));

Rainbow Demo #

If you want a specific color, you can call the xterm() with the index listed in the rainbow below. To show the rainbow on your own terminal, pub run examples/ansicolor.dart

alt tag

26
likes
110
pub points
98%
popularity

Looking to add some color to your terminal logs? `ansicolor` is an xterm-256 color support library that lets you change the foreground and background color of your text.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

codefu@google.com

License

Apache 2.0 (LICENSE)

More

Packages that depend on ansicolor