ansi

Haxe utility for working with ANSI escape sequences
https://github.com/SmilyOrg/ansi

To install, run:

haxelib install ansi 1.0.0 

See using Haxelib in Haxelib documentation for more information.

README.md

ansi

Haxe utility for working with ANSI escape sequences.

Provides functions that return a String with the appropriate ANSI escape sequence. This is usually written to standard output for the hosting console to process.

Note: If the console doesn't support the escape sequences (e.g. default Command Prompt on Windows), you're going to see garbage.

Tested with the neko target and ansicon.

Examples

Text Color

Sys.stdout().writeString(ANSI.set(ANSI.attr.Green) + "green text");

or shortened by importing ANSI and with it the Attribute enum:

import ANSI;
...
Sys.stdout().writeString(ANSI.set(Green) + "green text");

example


Sys.stdout().writeString(
	ANSI.set(Green, Bold) + "vivid green text" +
	ANSI.set(DefaultForeground) + " normal text"
);

example


Move and Delete

Sys.stdout().writeString("hello world" + ANSI.moveLeft(5) + ANSI.deleteChars(5) + "ansi");

example


Window Title

Sys.stdout().writeString(ANSI.title("Window title goes here"));

example


Particles!

See Test.hx.

particles gif

Contributors
Smily
Version
1.0.0
Published
8 years ago
License
MIT

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub