1#ifndef KOUTIL_TERM_COLOR_OPERATORS_H
2#define KOUTIL_TERM_COLOR_OPERATORS_H
12namespace color_literals {
21 consteval Color operator""_color(
const char* str, std::size_t size) {
22 std::string_view hex(str, size);
33 consteval ColorBG operator""_bg(
const char* str, std::size_t size) {
34 std::string_view hex(str, size);
45 consteval ColorFG operator""_fg(
const char* str, std::size_t size) {
46 std::string_view hex(str, size);
std::ostream & operator<<(std::ostream &stream, ColorBG bg)
Definition color_operators.h:52
std::ostream & reset_fg(std::ostream &stream)
Resets foreground color to default.
Definition color_operators.h:95
std::ostream & reset_color(std::ostream &stream)
Resets foreground and background color to default.
Definition color_operators.h:105
std::ostream & reset_bg(std::ostream &stream)
Resets background color to default.
Definition color_operators.h:85
constexpr char ESC
Definition utils.h:20
Structure representing a background color.
Definition color.h:198
const Color color
Definition color.h:202
Structure representing a foreground color.
Definition color.h:208
const Color color
Definition color.h:212
Structure representing a color.
Definition color.h:23
constexpr channel_t id() const
Gets the ID value of the color.
Definition color.h:143
constexpr ColorBG as_bg() const
Converts the color to a ColorBG object.
Definition color.h:215
const channel_t red
Definition color.h:32
constexpr ColorFG as_fg() const
Converts the color to a ColorFG object.
Definition color.h:217
const Tag tag
Definition color.h:35
const channel_t blue
Definition color.h:34
const channel_t green
Definition color.h:33
static consteval Color from_hex(std::string_view hex)
Creates a Color object from a hexadecimal string.
Definition color.h:106