Skip to content

Shadowsith/cli-textformat-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cli-textformat-cpp

Textformatpp is a lightweight C++ library to write colored and formated code onto the linux terminal/cli.
It has intentionally no class overhead to keep it as lightweight as possible and it is only capsuled into the 'text' namespaces.

Motivation

I was inspired by this stackoverflow post to make a good color/simple format library for C++ error and test messages on linux terminal.

Features

  • Coloring text (black, red, green, yellow, blue, magenta, cyan, white)
    • foreground and background support
  • bold, underline and inverse text
  • multiline support

Installation

  • Copy the source and header file from /src into your project and import the header.

Examples

test.cpp is a reference how it works and can compiled and run with the Makefile

make run

The library is capsuled at the namespace text. I don't recommend to use the using text; statement.

Below are also some examples:

std::cout << text::green("Hello World!") << std::endl; // green text at console output
std::cout << text::green("Multi line Example", true) << std::endl; // enables multiline support 
std::cout << "Test" << std::endl; // green text 
std::cout << "Hello" << text::disable_multiline() << std::endl; // green text, disables multiline 
std::cout << "Normal" << std::endl; // normal console output (not green); 
std::cout << text::bold(text::underline(text::red)) << std::endl; // bold and green 

TODO

  • port to other languages when finished

Support

If some errors appears please write a issue that I can fix it.

License

MIT

About

C++ lib to dye messages that are printed to the linux-cli

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy