Giter Site home page Giter Site logo

ansi's Introduction

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

ansi's People

Contributors

jonasmalacofilho avatar smilyorg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansi's Issues

Haxelib

Are you planning to release it on haxelib?

Copyright and license

I would like to use this (or, more specifically, a variant of this) in an open-source project.

Is this code open-source and, if so, can you add copyright and license information to the repository?

`Attribute` enum is not compatible with PHP 8

In PHP 8, Attribute is a reserved class name due to the introduction of attributes.
When the Attribute enum is compiled to PHP, an Attribute PHP class is generated, resulting in this error at runtime:

PHP Fatal error:  Uncaught Error: Call to undefined method Attribute::Off() in [...]\ANSI.php:598

So the Attribute enum should be renamed. Or better this library should be put in a package instead of the root namespace.

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.