neoansi

ANSI escape sequences and styling micro-library written in fluent/modern Dart.

On pub.dev Code coverage Github action status Dartdocs Style guide

This library provides minimal ANSI escape sequences and helpers for working with ANSI text terminals and terminal emulators, in which escape characters and embedded values are interpreted as commands.

For example, for terminals with 16-bit (256) color support:

Example output

Usage

import 'dart:io';

import 'package:neoansi/neoansi.dart';

void main() {
  AnsiSink.from(stdout)
    ..setForegroundColor(Ansi1BitColors.red)
    ..write('Hello ')
    ..setForegroundColor(Ansi1BitColors.green)
    ..setUnderlined()
    ..write('World')
    ..resetStyles()
    ..writeln('!');
}

Contributing

This package welcomes new issues and pull requests.

Changes or requests that do not match the following criteria will be rejected:

  1. Common decency as described by the Contributor Covenant.
  2. Making this library brittle/extensible by other libraries.
  3. Adding platform-specific functionality.
  4. A somewhat arbitrary bar of “complexity”, everything should be easy to use.

Resources

Inspiration

Some inspiration/motivational sources elsewhere in pub (Dart) packages:

Note from Matan: Many of these packages do an adequate job, but none of them had quite the API I wanted, so like many before them, this library was created. Use whatever makes the most sense to you!

GitHub

View Github