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

Overview

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!

You might also like...

A simple PokeDex App with Modern UI created using Flutter and Dart and using API from PokeApi.

A simple PokeDex App with Modern UI created using Flutter and Dart and using API from PokeApi.

FlutterDex FlutterDex A simple PokeDex App created using Flutter and Dart and using API from PokeApi. UI Design inspired by : Home Screen Pokedex iOS

Jan 1, 2023

This Country Selector UI Library written by Dart and Fluter and supports three locales with country's name, achieves lazy loading, and country card animation on listview

This Country Selector UI Library written by Dart and Fluter and supports three locales with country's name, achieves lazy loading, and country card animation on listview

Country Selector Widget This Country Selector Widget UI Library written by Dart and Fluter and supports three locales with country's name, achieves la

Nov 15, 2022

Extensions and principles for modern Dart development.

neodart Neo-Dart, or "new" Dart, is a series of recommended packages and principles that break out of classic conventions ("we've always done it that

Dec 6, 2022

The lightweight and powerful wrapper library for Twitter Ads API written in Dart and Flutter 🐦

TODO: Put a short description of the package here that helps potential users know whether this package might be useful for them. Features TODO: List w

Aug 26, 2022

Simple and fast Entity-Component-System (ECS) library written in Dart.

Simple and fast Entity-Component-System (ECS) library written in Dart.

Fast ECS Simple and fast Entity-Component-System (ECS) library written in Dart. CPU Flame Chart Demonstration of performance for rotation of 1024 enti

Nov 16, 2022

An incremental DOM library, with support for virtual DOM and components, written in Dart.

domino - a DOM library in Dart Inspired by Google's incremental-dom library, package:domino is a Dart-native DOM library supporting incremental DOM up

Dec 26, 2022

A lightweight and powerful batch library written in Dart

A lightweight and powerful batch library written in Dart

A lightweight and powerful batch library written in Dart. You can easily develop a job schedule and batch program in Dart with this library.

Dec 13, 2022

Mysql.dart - MySQL client for Dart written in Dart

Native MySQL client written in Dart for Dart See example directory for examples

Dec 29, 2022

Modern UI with Flutter for Web, Android, Windows and Linux.

Modern UI with Flutter for Web, Android, Windows and Linux.

Apr 9, 2022
Comments
  • Fix some clear methods

    Fix some clear methods

    The clearScreenAfter / clearScreenBefore and clearLineAfter / clearLineBefore methods were swapped, this PR fixes their order.

    A simple program showing the issue:

    import 'dart:io';
    
    import 'package:neoansi/neoansi.dart';
    
    void main(List<String> args) async {
      final console = AnsiWriter.from(stdout);
    
      console.write('#########\n' * 3);
      console.moveCursorUp(2);
      console.moveCursorRight(4);
      if (args.single == 'clearLineAfter') {
        console.clearLineAfter();
      } else if (args.single == 'clearLineBefore') {
        console.clearLineBefore();
      } else if (args.single == 'clearScreenAfter') {
        console.clearScreenAfter();
      } else if (args.single == 'clearScreenBefore') {
        console.clearScreenBefore();
      }
    
      console.write('\r');
      console.moveCursorDown(2);
    }
    

    After this change we get the expected result:

    > dart clear.dart clearLineAfter
    #########
    ####
    #########
    > dart clear.dart clearLineBefore
    #########
         ####
    #########
    > dart clear.dart clearScreenBefore
    
         ####
    #########
    > dart clear.dart clearScreenAfter 
    #########
    ####
    
    
    opened by PixelToast 0
Owner
Neo Dart
Neo Dart
Terminal styling done right - now for Dart!

vscode debug console windows terminal Console/Terminal text coloring and styling library for Dart 'Terminal string styling done right' I created this

Tim Maffett 4 Dec 10, 2022
A cross-platform Fediverse client for micro-blogging services written in Flutter/Dart.

Kaiteki A 快適 (kaiteki) Fediverse client for microblogging instances, made with Flutter and Dart. Currently, Kaiteki is still in a proof-of-concept/alp

Kaiteki 141 Jan 5, 2023
Fluent System Icons are a collection of familiar, friendly and modern icons from Microsoft.

Fluent UI System Icons Fluent UI System Icons are a collection of familiar, friendly and modern icons from Microsoft. Icon List View the full list of

Microsoft 4.3k Dec 29, 2022
A Dart micro-library for asserting at build time.

A micro-library for asserting at build time. It's a common practice to configure a Dart app using const (build-time) values. There are benefits to thi

Christopher Casey 17 Oct 14, 2022
Launcher for the reboot project written with Dart(Flutter) and Fluent UI compliant

reboot_launcher Launcher for project reboot Getting Started This project is a starting point for a Flutter application. A few resources to get you sta

Alessandro Autiero 3 Oct 22, 2022
This is a JazzCash UI clone ( Modern Wallet App in Pakistan), implementing modern app bar animmation. One can take a concept of making app bar with animation.

jazzcash_ui This is a JazzCash UI clone ( Modern Wallet App in Pakistan), implementing modern app bar animmation. One can take a concept of making app

null 9 Nov 27, 2022
A fluent API for generating valid Dart source code

A fluent, builder-based library for generating valid Dart code. Usage code_builder has a narrow and user-friendly API. See the example and test folder

Dart 330 Jan 7, 2023
Easy form building in Flutter with a fluent schema API.

former - Easy form building in Flutter Motivation Formik is one of my favorite React libraries. It is a form library that drastically reduces boilerpl

Kenneth 21 Oct 11, 2022
Implements Microsoft's Fluent Design System in Flutter.

fluent_ui Design beautiful native windows apps using Flutter Unofficial implementation of Fluent UI for Flutter. It's written based on the official do

Bruno D'Luka 1.8k Dec 29, 2022