ansicolor 0.0.5 copy "ansicolor: ^0.0.5" to clipboard
ansicolor: ^0.0.5 copied to clipboard

outdatedDart 1 only

An xterm 256 color support library

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 = false and all codes will be empty - no re-writing debug messages.

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.write("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.write("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, just call print(ansi_demo());

alt tag

140
likes
0
pub points
94%
popularity

Publisher

unverified uploader

An xterm 256 color support library

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on ansicolor