kaycxx-term
C++ terminal library
Loading...
Searching...
No Matches
kaycxx-term

Terminal output and key input helpers.

GitHub | API Documentation

Requirements

  • C++23 compiler and standard library
  • Exception support

Usage

#include <kaycxx/term.hpp>
using namespace kaycxx::term;
int main() {
auto term = terminal();
term << fg(green)
<< "Ready"
<< reset
<< '\n';
}
Terminal output and input helper.
Definition terminal.hpp:40
Includes the complete public kaycxx terminal API.

CMake users consume the installed package with:

find_package(kaycxx-term 1.0.0 CONFIG REQUIRED)
target_link_libraries(my-target PRIVATE kaycxx::term)

Non-CMake users can use pkg-config:

c++ $(pkg-config --cflags kaycxx-term) -c main.cpp
c++ main.o $(pkg-config --libs kaycxx-term)

Guides

  • Creating a Terminal explains output streams, ANSI mode selection, and color environment variables.
  • Colors and Styles explains SGR styles, basic colors, indexed colors, RGB colors, foregrounds, and backgrounds.
  • Cursor Control explains cursor movement, cursor visibility, cursor style, and save/restore.
  • Screen Control explains clearing, line/cell insertion and deletion, scrolling, and the alternate screen.
  • Links and Titles explains terminal hyperlinks and window title push/pop.
  • Input explains raw mode, input mode stacking, key reading, and Windows key sequence mapping.

Build From Source

cmake -B build
cmake --build build

A shared library is built by default. For a static build:

cmake -B build -D BUILD_SHARED_LIBS=OFF
cmake --build build

Install

cmake --install build --prefix /tmp/root

If no prefix is specified, CMake installs to /usr/local by default on Unix systems.

Development

Run all tests:

cmake --build build --target test

Generate API documentation with Doxygen:

cmake --build build --target apidoc

The generated HTML documentation is written to build/apidoc/html/index.html.