Coder Social home page Coder Social logo

hsuantinglu / ansi-escape Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 167 KB

ANSI escape codes wrapped in C++ streams

Home Page: https://hsuantinglu.github.io/ansi-escape/

License: MIT License

CMake 17.81% C++ 82.19%
terminal terminal-colors homebrew hacktoberfest

ansi-escape's Introduction

Ansi-Escape GitHub GitHub release (latest SemVer including pre-releases)

GitHub code size in bytes Codacy Badge

ANSI escape codes wrapped in C++ string streams.

It's everything you need for advanced terminal control, wrapped in light headers ready for inclusion.

Table of Contents

About Ansi-Escape

Ansi-Escape, or AESC, is an effort to wrap common terminal controls and colors for prettier terminal output. It is built and tested on macOS, but probably will work in other *NIX systems as well.

To maximize compatibility, we choose to support C++11, with CMake-3.9 as a build dependency.

Quickstart

AESC implemented most ANSI escape sequences, including text coloring and cursor controlling

there are example codes in the examples/ directory, see Install for more information.

Find detailed list of available APIs at docs and wikipedia

Simple example of text coloring

#include <iostream>
#include "aesc.hpp"
using namespace std;
using aesc::color;

int main() {
    cout << red << " foreground is red" << endl;

    cout << bright::red << bright::background::cyan
         << " background bright cyan, foreground bright red" << endl;

    cout << aesc::color256::RGB::foreground(2, 3, 0) << "256 color RGB test sequence"
         << endl;

    cout << aesc::truecolor::RGB::foreground(130, 250, 0)
         << "24-bit true color RGB test sequence" << aesc::render::reset << endl;
}

Simple example of cursor control

See the provided example at examples/show_color.cpp

Install

Install it with Homebrew, or build it using CMake

Install with Homebrew

brew tap hsuantinglu/utils
brew install ansi-escape

Build with CMake

CMake is the official build system. At least version 3.9 is needed.

mkdir build; cd build/

# Config and build
cmake .. && make showcolor

# execute example
./examples/showcolor

ansi-escape's People

Contributors

moshiba avatar

Watchers

 avatar  avatar

ansi-escape's Issues

Add CI

try github actions or travis

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.