GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Villy-P/cpp-console: A header only C++ library for easier logging to the console that includes features like coloring text, printing data structures, cursor manipulation, and more

BranchesTags
Open more actions menu

Latest commit

 

History

116 Commits
116 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
assets
assets
 
 
cmake
cmake
 
 
include
include
 
 
test
test
 
 
.clang-format
.clang-format
 
 
.gitignore
.gitignore
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CMakeLists.txt
CMakeLists.txt
 
 
Doxyfile
Doxyfile
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
makefile
makefile
 
 
vercel.json
vercel.json
 
 

Repository files navigation

CPPConsole

CPPConsole is a header-only library for C++ projects that adds features to the console to make logging easier, like getting dimensions, coloring text, etc.

Using CPPConsole

Manually copying include directory

To use CPPConsole in your project, copy all the file located in the include/ directory into your own personal include/ folder.

After that, you can add #include "cppconsole.hpp" to your file to include all CPPConsole functions, or include each file individually.

Using CMake

Add this code to your CMakeLists.txt:

include(FetchContent)

FetchContent_Declare(cppconsole
    GIT_REPOSITORY https://github.com/Villy-P/CPPConsole.git
    GIT_TAG        main # consider pinning to a release tag or commit SHA for reproducible builds
)
FetchContent_MakeAvailable(cppconsole)

target_link_libraries(your_target PRIVATE cppconsole::cppconsole)

Replace your_target with the name of your executable or library. All CPPConsole headers will now be available to it.

Features

  • ANSI Escape Code support
  • Cross-platform support for Windows and Linux for most functions
  • Colorizing text using RGB values
  • Moving the Console cursor
  • Getting Console Dimensions
  • Clearing parts of the Console
  • Manipulating text graphics, like making text bold/italic
  • Printing data structures, like vectors and maps

Examples

std::vector<std::string> vec = {"a", "b", "c", "d", "e"};
vec[0] = console::colorize(vec[0], 255, 255, 0);
console::println(vec);
console::set({console::Graphics::BOLD, console::Graphics::ITALIC});
console::Dimensions dim = console::getDimensions();
for (int i = 0; i < 256; ++i) {
    if (i % (dim.width / 4) == 0)
        console::println();
    console::print(console::colorize(std::string(3 - std::to_string(i).length(), ' ') + std::to_string(i), i) + " ");
}

Screenshots

Example 1 Example 2

Usage

console::print and console::println are the main function that are used for printing. These work with any data structure, from primitives to vectors and maps.

console::printAll and console::printlnAll take an infinite amount of arguments, seperating them by spaces

console::colorize takes a string and then a color, changing the color of the text

console::set takes a list of graphics modes, and sets them all (like BOLD and ITALIC)

console::clearGraphics clears all previous graphics modes.

More function can be found throughout the files.

Contributing

If you'd like to contribute to CPPConsole, or would like to report an issue, please read the Contributing Guidelines

License

CPPConsole is licensed under the MIT License

Changelog

CPPConsole's changlog, which includes previous changes and upcoming changes, can be found in CHANGELOG.md

About

A header only C++ library for easier logging to the console that includes features like coloring text, printing data structures, cursor manipulation, and more

cpp-console.vercel.app

Topics

clearcolorconsolecppcpp-consolecursor-manipulationheader-onlyheader-only-libraryterminal

Resources

Readme
MIT license

Contributing

Contributing
Activity

Stars

40 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.