kaycxx-term
C++ terminal library
Loading...
Searching...
No Matches
color_style.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Klaus Reimer <k@ailis.de>
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
11#include <kaycxx/term/color.hpp>
12
13namespace kaycxx::term {
14
31
38inline constexpr color_style fg(color value) noexcept {
39 return color_style{
40 .value = value,
41 .basic_base = 30,
42 .bright_base = 90,
43 .extended_base = 38
44 };
45}
46
53inline constexpr color_style bg(color value) noexcept {
54 return color_style{
55 .value = value,
56 .basic_base = 40,
57 .bright_base = 100,
58 .extended_base = 48
59 };
60}
61
62} // namespace kaycxx::term
Defines the terminal color value type.
std::variant< basic_color, indexed_color, rgb_color > color
Terminal color value.
Definition color.hpp:28
constexpr color_style fg(color value) noexcept
Creates a foreground color style.
Definition color_style.hpp:38
constexpr color_style bg(color value) noexcept
Creates a background color style.
Definition color_style.hpp:53
Color style command written to a terminal.
Definition color_style.hpp:18
int basic_base
Base SGR code for non-bright basic colors.
Definition color_style.hpp:23
color value
Color value to render.
Definition color_style.hpp:20
int bright_base
Base SGR code for bright basic colors.
Definition color_style.hpp:26
int extended_base
Extended SGR selector for indexed and RGB colors.
Definition color_style.hpp:29