ansicolor 0.1.0

  • Installing
  • Versions
  • 88

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.


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, just call print(ansi_demo()); or run src/demo.dart

alt tag

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  ansicolor: "^0.1.0"

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

      import 'package:ansicolor/ansicolor.dart';
Version Uploaded Documentation Archive
0.1.0 Feb 22, 2018 Go to the documentation of ansicolor 0.1.0 Download ansicolor 0.1.0 archive
0.0.9 Aug 20, 2013 Go to the documentation of ansicolor 0.0.9 Download ansicolor 0.0.9 archive
0.0.8 Jul 16, 2013 Go to the documentation of ansicolor 0.0.8 Download ansicolor 0.0.8 archive
0.0.7 Jul 16, 2013 Go to the documentation of ansicolor 0.0.7 Download ansicolor 0.0.7 archive
0.0.6 Jul 16, 2013 Go to the documentation of ansicolor 0.0.6 Download ansicolor 0.0.6 archive
0.0.5 Jul 16, 2013 Go to the documentation of ansicolor 0.0.5 Download ansicolor 0.0.5 archive
0.0.4 Jul 15, 2013 Go to the documentation of ansicolor 0.0.4 Download ansicolor 0.0.4 archive
0.0.3 Jul 15, 2013 Go to the documentation of ansicolor 0.0.3 Download ansicolor 0.0.3 archive
0.0.2 Jul 15, 2013 Go to the documentation of ansicolor 0.0.2 Download ansicolor 0.0.2 archive
0.0.1 Jul 15, 2013 Go to the documentation of ansicolor 0.0.1 Download ansicolor 0.0.1 archive


We analyzed this package on Jun 12, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.60.0
  • pana: 0.11.3


Describes how popular the package is relative to other packages. [more]
85 / 100
Code health derived from static analysis. [more]
100 / 100
Reflects how tidy and up-to-date the package is. [more]
80 / 100
Overall score:
Weighted score of the above. [more]
Learn more about scoring.


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:ansicolor/ansicolor.dart.


  • Maintain

    Changelog entries help clients to follow the progress in your code.

  • The description is too short.

    Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Maintain an example.

    Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use ansicolor.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.0.0 <2.0.0
Dev dependencies
test >=0.12.18