termstyle 1.0.0-pre.3
An open-source C++ header file that enables developers to easily define and apply customizable style presets for terminal outputs such as warnings, infos, and errors.
Loading...
Searching...
No Matches
tests/col16.cpp

This is an example of how to use the Codes enum class.

#include "../include/termstyle.hpp"
namespace ts = termstyle;
int main()
{
ts::PresetConfig debug_preset = {
.prefix = {
.text = "[DEBUG] ",
.prestyles = {ts::Color(ts::Codes::DIM), ts::Color(ts::Codes::FOREGROUND_CYAN)},
.poststyles = {ts::Color(ts::Codes::DIM_RESET)}
}
};
ts::addPreset("debug", debug_preset);
ts::print("debug", "This is a debug message printed using termstyle::print.");
ts::style("debug") << "This is a debug message printed using termstyle::style.";
return 0;
}
void addPreset(std::string name, PresetConfig preset)
Adds a preset with the given name and configuration.
Definition termstyle.hpp:634
void print(std::string preset, std::string text="")
Definition termstyle.hpp:666
StyledCout style(const std::string &preset)
Definition termstyle.hpp:717
Namespace for the termstyle library.
Definition termstyle.hpp:116
Struct for storing different types of colors.
Definition termstyle.hpp:384
Struct for storing preset configurations.
Definition termstyle.hpp:512
StyleString prefix
Definition termstyle.hpp:514
std::string text
Definition termstyle.hpp:421