ANSI-Project 1.0
Make quick ANSI formats to beautify terminal output
The ANSI-Project for C/C++

Make quick ANSI formats to beautify terminal output

WebPage: bruneo32.github.io/ANSI-Project

Installation

Download ansi.h and include it in your NASM program:

#include "ansi.h"

It only contains macros, you can include it in C++ without extern

Documentation

Check out the documentation of the ANSI-Project for C/C++

Quick Example

In C

#include <stdio.h>
#include "ansi.h"
int main(int argc, char *argv[]){
printf( "Normal "
ANSI_UNDER "UnderLine" ANSI_RESET " "
"\n\n"
);
for (int i=0; i < 256/4; i++) {
printf(ANSI_BK_RGB(%i, %i, %i)" ", i*4, i*4, i*4);
}
printf(ANSI_RESET "\n");
for (int i=0; i < 256/4; i++) {
printf(ANSI_BK_RGB(%i, 0, 0)" ", i*4);
}
printf(ANSI_RESET "\n");
for (int i=0; i < 256/4; i++) {
printf(ANSI_BK_RGB(0, %i, 0)" ", i*4);
}
printf(ANSI_RESET "\n");
for (int i=0; i < 256/4; i++) {
printf(ANSI_BK_RGB(0, 0, %i)" ", i*4);
}
printf(ANSI_RESET "\n"); // Always RESET at end
return 0;
}
#define ANSI_HIDE
Definition: ansi.h:50
#define ANSI_BK_RGB(r, g, b)
Definition: ansi.h:148
#define ANSI_UNDER
Definition: ansi.h:46
#define ANSI_BOLD
Definition: ansi.h:43
#define ANSI_ITALIC
Definition: ansi.h:45
#define ANSI_STRIKE
Definition: ansi.h:51
#define ANSI_RESET
Definition: ansi.h:41

In C++

#include <iostream>
#include "ansi.h"
using namespace std;
int main(int argc, char *argv[]){
cout << "Normal "
ANSI_UNDER "UnderLine" ANSI_RESET " "
"\n\n"
<< endl;
for (int i=0; i < 256/4; i++) {
cout << ansi::BK_RGB(i*4, i*4, i*4) << " ";
}
cout << ANSI_RESET << endl;
for (int i=0; i < 256/4; i++) {
cout << ansi::BK_RGB(i*4, 0, 0) << " ";
}
cout << ANSI_RESET << endl;
for (int i=0; i < 256/4; i++) {
cout << ansi::BK_RGB(0, i*4, 0) << " ";
}
cout << ANSI_RESET << endl;
for (int i=0; i < 256/4; i++) {
cout << ansi::BK_RGB(0, 0, i*4) << " ";
}
cout << ANSI_RESET << endl; // Always RESET at end
return 0;
}