#include <memory>
#include <utility>
#include <vector>
#include "./color_info_sorted_2d.ipp"
int main() {
auto basic_color_display =
text(
"16 color palette:"),
color(Color::GreenLight,
text(
"GreenLight")),
color(Color::MagentaLight,
text(
"MagentaLight")),
color(Color::YellowLight,
text(
"YellowLight"))
),
)
)
);
auto palette_256_color_display =
text(
"256 colors palette:");
{
std::vector<std::vector<ColorInfo>> info_columns = ColorInfoSorted2D();
for (auto& column : info_columns) {
for (auto& it : column) {
column_elements.push_back(
}
columns.push_back(
hbox(std::move(column_elements)));
}
palette_256_color_display =
vbox({
palette_256_color_display,
});
}
auto true_color_display =
text(
"TrueColors: 24bits:");
{
const int max_value = 255;
const int value_increment = 8;
const int hue_increment = 6;
int saturation = max_value;
for (int value = 0; value < max_value; value += 2 * value_increment) {
for (int hue = 0; hue < max_value; hue += hue_increment) {
line.push_back(
|
color(Color::HSV(hue, saturation, value))
|
bgcolor(Color::HSV(hue, saturation, value + value_increment)));
}
array.push_back(
hbox(std::move(line)));
}
true_color_display =
vbox({
true_color_display,
});
}
auto terminal_info =
?
text(
" 16 color palette support : Yes")
:
text(
" 16 color palette support : No"),
?
text(
"256 color palette support : Yes")
:
text(
"256 color palette support : No"),
?
text(
" True color support : Yes")
:
text(
" True color support : No"),
}) |
basic_color_display,
palette_256_color_display,
true_color_display,
}),
terminal_info});
screen.Print();
return 0;
}
Dimensions Fit(Element &)
Color ColorSupport()
Get the color support of the terminal.
Decorator bgcolor(Color)
Decorate using a background color.
Element hbox(Elements)
A container displaying elements horizontally one by one.
Element text(std::wstring text)
Display a piece of unicode text.
std::vector< Element > Elements
Element separator()
Draw a vertical or horizontal separation in between two other elements.
void Render(Screen &screen, const Element &element)
Display an element on a ftxui::Screen.
Element border(Element)
Draw a border around the element.
Decorator color(Color)
Decorate using a foreground color.
Element vbox(Elements)
A container displaying elements vertically one by one.