ansi 1.0.0

Haxe utility for working with ANSI escape sequences

Released 2017-01-11.

To install, run:

haxelib install ansi 1.0.0

See using Haxelib in Haxelib documentation for more information.

MaintainerSmily
Websitehttps://github.com/SmilyOrg/ansi
Current version1.0.0
StatisticsInstalled 1245 times
LicenseMIT
Tags cross

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