Projects · Tools & libraries

HPrint

Stable 2026 Author

Header-only C++23 utility for centred terminal headers, with compile-time border characters, UTF-8 aware width and terminal size detection.

A tiny library that does one thing well: print a header centred in the terminal.

#include <hprint>

hp::print<'>'>("Build started");
hp::printf<'#'>("Phase {}", 1);
hp::print<'*'>("日本語のヘッダー", 60);
  • Border characters are template parameters, so the choice is made at compile time.
  • std::format-style formatting through hp::printf / hp::printfw.
  • Display width is UTF-8 aware, so wide CJK characters stay centred.
  • Terminal width is detected on POSIX and Windows, with an 80-column fallback when output isn't a terminal.
  • Consumable through CMake FetchContent or find_package, with an installable config package.