GithubHelp home page GithubHelp logo

ansicolor-dart's Introduction

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 = 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"));

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

ansicolor-dart's People

Contributors

davidmorgan avatar jtmcdole avatar lyceel avatar michaelrfairhurst avatar sigmundch avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.