ppforest2 v0.1.0
Projection Pursuit Decision Trees and Random Forests
Loading...
Searching...
No Matches
Color.hpp File Reference

TTY-aware colored terminal output utilities. More...

#include <string>
#include <fmt/color.h>
#include <fmt/format.h>
#include <unistd.h>

Go to the source code of this file.

Namespaces

namespace  ppforest2
 
namespace  ppforest2::io
 
namespace  ppforest2::io::style
 TTY-aware ANSI colored output utilities.
 

Functions

bool & ppforest2::io::style::color_enabled ()
 Global toggle for colored output.
 
std::string ppforest2::io::style::emphasis (std::string const &s)
 Format text in bold (for emphasis / labels).
 
std::string ppforest2::io::style::error (std::string const &s)
 Format text in red (for error messages).
 
std::string ppforest2::io::style::info (std::string const &s)
 Format text in cyan (for informational highlights like progress bars).
 
void ppforest2::io::style::init_color (bool no_color)
 Initialize color support based on TTY detection and user preference.
 
std::string ppforest2::io::style::muted (std::string const &s)
 Format text in dim gray (for hints and secondary info).
 
std::string ppforest2::io::style::styled (std::string const &s, fmt::terminal_color c)
 Apply a foreground color with a specific reset (\033[39m) instead of fmt's full reset, so that emphasis and other non-fg styles survive nesting.
 
std::string ppforest2::io::style::success (std::string const &s)
 Format text in green (for success messages).
 
std::string ppforest2::io::style::warning (std::string const &s)
 Format text in yellow (for warnings).
 

Detailed Description

TTY-aware colored terminal output utilities.

Wraps the fmt/color.h library with conditional formatting that automatically disables ANSI escape codes when stdout is not a TTY or when the user passes the –no-color flag. On Windows, enables Virtual Terminal Processing for ANSI support.