Skip to content

C++ «header-only» library for controlling the color and style of terminal text output.

License

LGPL-3.0, GPL-3.0 licenses found

Licenses found

LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING
Notifications You must be signed in to change notification settings

Dolfost/colorit-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

colorit

demo

This C++ the library simplifies changing the appearance of the terminal text output.
Independently of each other you can change the style and color of the text, the background color.

Usage

Functions

char* setBack(short arg),
char* setFore(short arg);
Arguments:
short arg: 1 of 256 color format. range: [0 - 255];
Return:
char*: ansicode. See showall.cpp for example.

char* setBack(short r, short g, short b),
char* setFore(short r, short g, short b);
Arguments:
short r, g, b: RGB color format. range of each varriable: [0 - 255];
Return:
char*: ansicode. See showall.cpp for example.

Terminal colors

Colors

More about functions: libinfo.txt.

Constants

Text modes:

Style. Name
BOLD bold mode
DIM dim/faint mode
FAINT dim/faint mode
ITALIC italic mode
UNDERLINE underline mode
OVERLINE overline mode
BLINKING blinking mode
INVERT invert/reverse mode
REVERSE invert/reverse mode
HIDE invisible mode
STRIKE strikethrough mode

Foreground colors:

Fore. Name
BLACK black
RED red
GREEN green
YELLOW yellow
BLUE blue
MAGNETA magneta
CYAN cyan
WHITE white

Backgroud colors:

Back. Name
BLACK black
RED red
GREEN green
YELLOW yellow
BLUE blue
MAGNETA magneta
CYAN cyan
WHITE white

Reset

Style. Name
RST style reset, resets all changes

Example:

#include <iostream>
#include "colorit/colorit.hpp"

int main(void) {
  std::cout << Fore.RED <<  Style.ITALIC << "Hello!" << Style.RST << "\n"; // prints red text in italic style (mode)
  return 0;
}

That's not all, the rest of constants, aliases, modes and other libinfo: libinfo.txt.


License: LGPL-3.0

GNU General Public License v3.0

Coffe...? PayPal

About

C++ «header-only» library for controlling the color and style of terminal text output.

Resources

License

LGPL-3.0, GPL-3.0 licenses found

Licenses found

LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING

Stars

Watchers

Forks

Languages