Skip to content

Havoc's single-file terminal utility library for modern C and C++.

License

Notifications You must be signed in to change notification settings

Havoc7891/havTermKit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

havTermKit

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.

Table of Contents

Features

  • 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

Quick Start

  1. Copy havTermKit.h into your project.
  2. Include the header:
#include "havTermKit.h"
  1. Call init once at startup:
havTermKit_Init();
  1. Use the provided macros in output:
printf(ANSI_FG_BRIGHT_GREEN "Success" ANSI_RESET "\n");
printf(ANSI_UNDERLINE "Underlined text" ANSI_RESET "\n");

Minimal C Example

#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;
}

Build

Linux / macOS (GCC / Clang):

gcc main.c -o app
./app

Windows (GCC in PowerShell / CMD):

gcc main.c -o app.exe
app.exe

Minimal C++ Example

#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;
}

Build

Linux / macOS (G++ / Clang++):

g++ main.cpp -o app
./app

Windows (G++ in PowerShell / CMD):

g++ main.cpp -o app.exe
app.exe

Basic API

Initialization

  • havTermKit_Init()

Common Macros

  • 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

Contributing

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.

License

Copyright © 2026 René Nicolaus

This library is released under the MIT license.

About

Havoc's single-file terminal utility library for modern C and C++.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages