Giter Club home page Giter Club logo

ansi-hx's Introduction

ANSI.hx

A haxe library with easy access to ANSI commands / escape codes.

Implements most commands allowing for complete control of the terminal.

Getting Started

install using this git repo

haxelib git http://www.github.com/snsvrno/ansi-hx.git

and then use to make rich terminal applications

import ansi.Paint.*;
// you can use single commands it change different aspects

Sys.println(background(Cyan) + bold() + " [ ANSI.hx ] " + reset());
Sys.println(color(Magenta) + "It's " + italic() + color() + "Great!" + italic(false));

// or you can use the paint wrapper

Sys.println(paint(" [ ANSI.hx ] ", null, Cyan, Bold));
Sys.println(paint("It's ", Magenta) + paint("Great!", Standout));

output of the above commands

General Usage

There are two main packages:

  1. ansi.Command - sends commands to the terminal
  2. ansi.Paint - creates command strings that need to be written to the terminal

Features

Color Fallback

By default ANSI.hx will be using True Color mode. This should allow you to print to the terminal using all 24bits of colors.

All though all modern terminals should support this, there maybe some that do not. ANSI.hx has a fallback so that things will look somewhat like you want them.

In order to enable fallback you need to run the color mode check function

ansi.colors.ColorMode.check();

This will determine if the terminal supports True Color 256 Color or just the standard 16 colors.

Everything else will automatically evaluate based on what the terminal supports.

Sys.println(backgroundRGB(0, 230, 0));

This will show the actual rgb color of (0,230,0) if True Color, the closest 256 color of index 46 (0,255,0) in 256 Color or the standard color of Green.

3 different outputs based on the color mode of terminal

It is imporant to note that the standard color scheme may vary drastically from the desired color because of a user's terminal theme.

ansi-hx's People

Contributors

snsvrno avatar

Stargazers

Sylvio Sell avatar Datee avatar

Watchers

 avatar

ansi-hx's Issues

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.