quill
Public Member Functions | Static Public Attributes | Friends | List of all members
ConsoleSinkConfig::Colours Class Reference

Represents console colours. More...

#include <ConsoleSink.h>

Public Member Functions

void apply_default_colours () noexcept
 Sets some default colours for terminal.
 
void assign_colour_to_log_level (LogLevel log_level, std::string_view colour) noexcept
 Sets a custom colour per log level. More...
 
QUILL_ATTRIBUTE_COLD void set_colours_enabled (bool value)
 
QUILL_NODISCARD bool colours_enabled () const noexcept
 
QUILL_NODISCARD std::string_view log_level_colour (LogLevel log_level) const noexcept
 The colour for the given log level. More...
 

Static Public Attributes

static constexpr std::string_view reset {"\033[0m"}
 
static constexpr std::string_view bold {"\033[1m"}
 
static constexpr std::string_view dark {"\033[2m"}
 
static constexpr std::string_view underline {"\033[4m"}
 
static constexpr std::string_view blink {"\033[5m"}
 
static constexpr std::string_view reverse {"\033[7m"}
 
static constexpr std::string_view concealed {"\033[8m"}
 
static constexpr std::string_view clear_line {"\033[K"}
 
static constexpr std::string_view black {"\033[30m"}
 
static constexpr std::string_view red {"\033[31m"}
 
static constexpr std::string_view green {"\033[32m"}
 
static constexpr std::string_view yellow {"\033[33m"}
 
static constexpr std::string_view blue {"\033[34m"}
 
static constexpr std::string_view magenta {"\033[35m"}
 
static constexpr std::string_view cyan {"\033[36m"}
 
static constexpr std::string_view white {"\033[37m"}
 
static constexpr std::string_view on_black {"\033[40m"}
 Background colors.
 
static constexpr std::string_view on_red {"\033[41m"}
 
static constexpr std::string_view on_green {"\033[42m"}
 
static constexpr std::string_view on_yellow {"\033[43m"}
 
static constexpr std::string_view on_blue {"\033[44m"}
 
static constexpr std::string_view on_magenta {"\033[45m"}
 
static constexpr std::string_view on_cyan {"\033[46m"}
 
static constexpr std::string_view on_white {"\033[47m"}
 
static constexpr std::string_view white_bold {"\033[97m\033[1m"}
 Bold colors.
 
static constexpr std::string_view yellow_bold {"\033[33m\033[1m"}
 
static constexpr std::string_view red_bold {"\033[31m\033[1m"}
 
static constexpr std::string_view bold_on_red {"\033[1m\033[41m"}
 

Friends

class ConsoleSink
 

Detailed Description

Represents console colours.

Member Function Documentation

◆ assign_colour_to_log_level()

void ConsoleSinkConfig::Colours::assign_colour_to_log_level ( LogLevel  log_level,
std::string_view  colour 
)
inlinenoexcept

Sets a custom colour per log level.

Parameters
log_levelthe log level
colourthe colour

◆ colours_enabled()

QUILL_NODISCARD bool ConsoleSinkConfig::Colours::colours_enabled ( ) const
inlinenoexcept
Returns
true if we are in terminal and have also enabled colours

◆ log_level_colour()

QUILL_NODISCARD std::string_view ConsoleSinkConfig::Colours::log_level_colour ( LogLevel  log_level) const
inlinenoexcept

The colour for the given log level.

Parameters
log_levelthe message log level
Returns
the configured colour for this log level

The documentation for this class was generated from the following file: