Havoc's single-file terminal utility library for modern C and C++.
It provides ANSI escape macros for text styling, colors, cursor control, screen clearing, and hyperlinks, plus a small init function to enable VT support and UTF-8 behavior on Windows.
- Header-only (
havTermKit.h) - Works with C and C++
- ANSI text styles: bold, underline, italic, reverse, hidden, strike, reset variants
- 16-color foreground / background palettes (normal + bright)
- 256-color and truecolor helper macros
- Cursor movement, save / restore, clear line / screen macros
- OSC hyperlink macros
- Windows-friendly initialization (
havTermKit_Init) for VT processing + UTF-8 console setup
- Copy
havTermKit.hinto your project. - Include the header:
#include "havTermKit.h"- Call init once at startup:
havTermKit_Init();- Use the provided macros in output:
printf(ANSI_FG_BRIGHT_GREEN "Success" ANSI_RESET "\n");
printf(ANSI_UNDERLINE "Underlined text" ANSI_RESET "\n");#include <stdio.h>
#include "havTermKit.h"
int main(void)
{
havTermKit_Init();
printf(ANSI_FG_BRIGHT_GREEN "\u2714 Success" ANSI_RESET "\n");
printf(ANSI_FG_BRIGHT_RED "\u2716 Error" ANSI_RESET "\n");
printf(ANSI_UNDERLINE "Underlined text" ANSI_RESET "\n");
printf(ANSI_LINK_START("https://test.com") "Open test.com" ANSI_LINK_END "\n");
return 0;
}Linux / macOS (GCC / Clang):
gcc main.c -o app
./appWindows (GCC in PowerShell / CMD):
gcc main.c -o app.exe
app.exe#include <iostream>
#include "havTermKit.h"
int main()
{
havTermKit_Init();
std::cout << ANSI_FG_BRIGHT_GREEN << "\u2714 Success" << ANSI_RESET << "\n";
std::cout << ANSI_FG_BRIGHT_RED << "\u2716 Error" << ANSI_RESET << "\n";
std::cout << ANSI_UNDERLINE << "Underlined text" << ANSI_RESET << "\n";
std::cout << ANSI_LINK_START("https://test.com") << "Open test.com" << ANSI_LINK_END
<< "\n";
return 0;
}Linux / macOS (G++ / Clang++):
g++ main.cpp -o app
./appWindows (G++ in PowerShell / CMD):
g++ main.cpp -o app.exe
app.exehavTermKit_Init()
- Reset:
ANSI_RESET - Styles:
ANSI_BOLD,ANSI_UNDERLINE,ANSI_ITALIC,ANSI_STRIKETHROUGH, etc. - Foreground colors:
ANSI_FG_RED,ANSI_FG_BRIGHT_CYAN, etc. - Background colors:
ANSI_BG_BLUE,ANSI_BG_BRIGHT_YELLOW, etc. - 256 colors:
ANSI_FG_256("196"),ANSI_BG_256("27") - RGB colors:
ANSI_FG_RGB("255","120","0"),ANSI_BG_RGB("20","20","20") - Cursor / screen:
ANSI_CURSOR_UP("2"),ANSI_CLEAR_LINE,ANSI_CLEAR_SCREEN - Hyperlinks:
ANSI_LINK_START("https://test.com") "Open test.com" ANSI_LINK_END
Thank you for your interest! Suggestions for features and bug reports are always welcome via issues.
To maintain a consistent design and quality for this library, changes are implemented by the maintainer rather than via direct pull requests.
Copyright © 2026 René Nicolaus
This library is released under the MIT license.