FTXUI  5.0.0
C++ functional terminal UI.
pixel.hpp
Go to the documentation of this file.
1 // Copyright 2024 Arthur Sonzogni. All rights reserved.
2 // Use of this source code is governed by the MIT license that can be found in
3 // the LICENSE file.
4 #ifndef FTXUI_SCREEN_PIXEL_HPP
5 #define FTXUI_SCREEN_PIXEL_HPP
6 
7 #include <cstdint> // for uint8_t
8 #include <string> // for string, basic_string, allocator
9 #include "ftxui/screen/color.hpp" // for Color, Color::Default
10 
11 namespace ftxui {
12 
13 /// @brief A Unicode character and its associated style.
14 /// @ingroup screen
15 struct Pixel {
17  : blink(false),
18  bold(false),
19  dim(false),
20  inverted(false),
21  underlined(false),
22  underlined_double(false),
23  strikethrough(false),
24  automerge(false) {}
25 
26  // A bit field representing the style:
27  bool blink : 1;
28  bool bold : 1;
29  bool dim : 1;
30  bool inverted : 1;
31  bool underlined : 1;
33  bool strikethrough : 1;
34  bool automerge : 1;
35 
36  // The hyperlink associated with the pixel.
37  // 0 is the default value, meaning no hyperlink.
38  // It's an index for accessing Screen meta data
39  uint8_t hyperlink = 0;
40 
41  // The graphemes stored into the pixel. To support combining characters,
42  // like: a?, this can potentially contain multiple codepoints.
43  std::string character = "";
44 
45  // Colors:
48 };
49 
50 } // namespace ftxui
51 
52 #endif // FTXUI_SCREEN_PIXEL_HPP
A class representing terminal colors.
Definition: color.hpp:20
A Unicode character and its associated style.
Definition: pixel.hpp:15
uint8_t hyperlink
Definition: pixel.hpp:39
bool inverted
Definition: pixel.hpp:30
bool strikethrough
Definition: pixel.hpp:33
Color foreground_color
Definition: pixel.hpp:47
bool blink
Definition: pixel.hpp:27
Color background_color
Definition: pixel.hpp:46
std::string character
Definition: pixel.hpp:43
bool dim
Definition: pixel.hpp:29
bool bold
Definition: pixel.hpp:28
bool underlined
Definition: pixel.hpp:31
bool automerge
Definition: pixel.hpp:34
bool underlined_double
Definition: pixel.hpp:32