ansicolor

v2.0.3

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.

Архив пакета: https://pubdev.letsnova.ru/api/archives/ansicolor/2.0.3.tar.gz

Установкаdart pub add ansicolor

README

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 = AnsiPen()..white(bold: true);
                print(pen("Bright white foreground") + " this text is default fg/bg");
                

Background as a peach, foreground as white:

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

Note

If color isn't working for you; try setting ansiColorDisabled = false;. We're relying on the stdio object to inform us of ANSI terminal support. Sometimes this is wrong.

Prior versions of this library just turned on color by default.

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

История изменений

Changes

2.0.3

  • WASM support

2.0.2

  • Public getters for pen colors.
  • Updated to Dart 3.0

2.0.1

  • Update to default 2.12.0 for null safety before publishing.

2.0.0-nullsafety.0

  • This package was already nullsafe; this just makes it official.

1.1.1

  • Pre-upgrade for nullsafety
  • clamp has a num signature, also doesn't follow inclusive-exclusive ranges, [), and is instead inclusive-inclusive, ().

1.1.0

  • Round up release closing out some older issues.
    • Try to detect is ANSI is supported
    • Update naming style; deprecate the old names.
    • write() and call() take object now.

1.0.5

  • Add types to API calls

1.0.4

  • Update styling, remove new, use final or var.
  • Support null safety

1.0.3

  • Minor updates to optional name style (s/:/=)
  • Make the description better

1.0.2

  • Adding this CHANGELOG.md
  • Moving bin/demo.dart to examples/ansicolor.dart

1.0.1

  • Updated authors

1.0.0

  • Dart 2.0 support!