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.
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"));
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
Add this to your package's pubspec.yaml file:
dependencies: ansicolor: "^0.0.9"
You can install packages from the command line:
$ pub get
$ flutter packages get
Alternatively, your editor might support
pub get or
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
|0.0.9||Aug 20, 2013|
|0.0.8||Jul 16, 2013|
|0.0.7||Jul 16, 2013|
|0.0.6||Jul 16, 2013|
|0.0.5||Jul 16, 2013|
|0.0.4||Jul 15, 2013|
|0.0.3||Jul 15, 2013|
|0.0.2||Jul 15, 2013|
|0.0.1||Jul 15, 2013|
We analyzed this package, and provided a score, details, and suggestions below.
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Detected platforms: Flutter, server, web
All libraries agree
Changelog entries help clients to follow the progress in your code.