microfmt
Zero-allocation C++ formatting for constrained environments
Loading...
Searching...
No Matches
Classes | Namespaces | Enumerations | Functions | Variables
ansi.hpp File Reference

ANSI terminal color and text-style formatting views. More...

#include "../microfmt.hpp"
#include <cstdint>
#include <string_view>
#include "ansi.ipp"
Include dependency graph for ansi.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  microfmt::ansi::style
 
struct  microfmt::ansi::styled_view< T >
 
struct  microfmt::formatter< ansi::style >
 
struct  microfmt::formatter< ansi::styled_view< T > >
 

Namespaces

namespace  microfmt
 
namespace  microfmt::ansi
 

Enumerations

enum class  microfmt::ansi::color : uint8_t {
  microfmt::ansi::none = 0 , microfmt::ansi::black = 30 , microfmt::ansi::red = 31 , microfmt::ansi::green = 32 ,
  microfmt::ansi::yellow = 33 , microfmt::ansi::blue = 34 , microfmt::ansi::magenta = 35 , microfmt::ansi::cyan = 36 ,
  microfmt::ansi::white = 37 , microfmt::ansi::bright_black = 90 , microfmt::ansi::bright_red = 91 , microfmt::ansi::bright_green = 92 ,
  microfmt::ansi::bright_yellow = 93 , microfmt::ansi::bright_blue = 94 , microfmt::ansi::bright_magenta = 95 , microfmt::ansi::bright_cyan = 96 ,
  microfmt::ansi::bright_white = 97
}
 
enum class  microfmt::ansi::attribute : uint8_t {
  microfmt::ansi::none = 0 , microfmt::ansi::bold = 1 << 0 , microfmt::ansi::dim = 1 << 1 , microfmt::ansi::italic = 1 << 2 ,
  microfmt::ansi::underline = 1 << 3 , microfmt::ansi::blink = 1 << 4 , microfmt::ansi::reverse = 1 << 5
}
 

Functions

RELOCO_BEGIN_UNSAFE_CODE constexpr attribute microfmt::ansi::operator| (attribute a, attribute b) noexcept
 
RELOCO_END_UNSAFE_CODE constexpr bool microfmt::ansi::operator& (attribute a, attribute b) noexcept
 
MICROFMT_API void microfmt::ansi::emit_style (const style &s, const sink &out) noexcept
 
MICROFMT_API void microfmt::ansi::emit_reset (const sink &out) noexcept
 
template<typename T >
constexpr styled_view< T > microfmt::ansi::styled (const T &val, style st) noexcept
 
template<typename T >
constexpr styled_view< T > microfmt::ansi::red (const T &val) noexcept
 
template<typename T >
constexpr styled_view< T > microfmt::ansi::green (const T &val) noexcept
 
template<typename T >
constexpr styled_view< T > microfmt::ansi::yellow (const T &val) noexcept
 
template<typename T >
constexpr styled_view< T > microfmt::ansi::blue (const T &val) noexcept
 
template<typename T >
constexpr styled_view< T > microfmt::ansi::magenta (const T &val) noexcept
 
template<typename T >
constexpr styled_view< T > microfmt::ansi::cyan (const T &val) noexcept
 
template<typename T >
constexpr styled_view< T > microfmt::ansi::white (const T &val) noexcept
 
template<typename T >
constexpr styled_view< T > microfmt::ansi::gray (const T &val) noexcept
 

Variables

constexpr style microfmt::ansi::reset {}
 
constexpr style microfmt::ansi::fg_black {color::black}
 
constexpr style microfmt::ansi::fg_red {color::red}
 
constexpr style microfmt::ansi::fg_green {color::green}
 
constexpr style microfmt::ansi::fg_yellow {color::yellow}
 
constexpr style microfmt::ansi::fg_blue {color::blue}
 
constexpr style microfmt::ansi::fg_magenta {color::magenta}
 
constexpr style microfmt::ansi::fg_cyan {color::cyan}
 
constexpr style microfmt::ansi::fg_white {color::white}
 
constexpr style microfmt::ansi::fg_gray {color::bright_black}
 
constexpr style microfmt::ansi::fg_bright_black {color::bright_black}
 
constexpr style microfmt::ansi::fg_bright_red {color::bright_red}
 
constexpr style microfmt::ansi::fg_bright_green {color::bright_green}
 
constexpr style microfmt::ansi::fg_bright_yellow {color::bright_yellow}
 
constexpr style microfmt::ansi::fg_bright_blue {color::bright_blue}
 
constexpr style microfmt::ansi::fg_bright_magenta {color::bright_magenta}
 
constexpr style microfmt::ansi::fg_bright_cyan {color::bright_cyan}
 
constexpr style microfmt::ansi::fg_bright_white {color::bright_white}
 
constexpr style microfmt::ansi::bg_black {color::none, color::black}
 
constexpr style microfmt::ansi::bg_red {color::none, color::red}
 
constexpr style microfmt::ansi::bg_green {color::none, color::green}
 
constexpr style microfmt::ansi::bg_yellow {color::none, color::yellow}
 
constexpr style microfmt::ansi::bg_blue {color::none, color::blue}
 
constexpr style microfmt::ansi::bg_magenta {color::none, color::magenta}
 
constexpr style microfmt::ansi::bg_cyan {color::none, color::cyan}
 
constexpr style microfmt::ansi::bg_white {color::none, color::white}
 
constexpr style microfmt::ansi::bg_gray {color::none, color::bright_black}
 
constexpr style microfmt::ansi::bg_bright_black {color::none, color::bright_black}
 
constexpr style microfmt::ansi::bg_bright_red {color::none, color::bright_red}
 
constexpr style microfmt::ansi::bg_bright_green {color::none, color::bright_green}
 
constexpr style microfmt::ansi::bg_bright_yellow {color::none, color::bright_yellow}
 
constexpr style microfmt::ansi::bg_bright_blue {color::none, color::bright_blue}
 
constexpr style microfmt::ansi::bg_bright_magenta {color::none, color::bright_magenta}
 
constexpr style microfmt::ansi::bg_bright_cyan {color::none, color::bright_cyan}
 
constexpr style microfmt::ansi::bg_bright_white {color::none, color::bright_white}
 
constexpr style microfmt::ansi::bold {color::none, color::none, attribute::bold}
 
constexpr style microfmt::ansi::dim {color::none, color::none, attribute::dim}
 
constexpr style microfmt::ansi::italic {color::none, color::none, attribute::italic}
 
constexpr style microfmt::ansi::underline {color::none, color::none, attribute::underline}
 
constexpr style microfmt::ansi::blink {color::none, color::none, attribute::blink}
 
constexpr style microfmt::ansi::reverse {color::none, color::none, attribute::reverse}
 
constexpr style microfmt::ansi::error_style {color::bright_red, color::none, attribute::bold}
 
constexpr style microfmt::ansi::warn_style {color::bright_yellow, color::none, attribute::bold}
 
constexpr style microfmt::ansi::ok_style {color::bright_green, color::none, attribute::bold}
 
constexpr style microfmt::ansi::info_style {color::bright_cyan, color::none, attribute::none}
 

Detailed Description

ANSI terminal color and text-style formatting views.