FTXUI 6.1.9 C++ functional terminal UI.

Loading...
Searching...
No Matches
style_color.cpp
Go to the documentation of this file.
1// Copyright 2020 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#include <ftxui/dom/linear_gradient.hpp> // for LinearGradient
5#include <ftxui/screen/screen.hpp> // for Full, Screen
6#include <memory> // for allocator
7
8#include "ftxui/dom/elements.hpp" // for text, bgcolor, color, vbox, filler, Fit, hbox
9#include "ftxui/dom/node.hpp" // for Render
10#include "ftxui/screen/color.hpp" // for Color, operator""_rgb, Color::Black, Color::Blue, Color::BlueLight, Color::Cyan, Color::CyanLight, Color::DeepSkyBlue4, Color::Default, Color::GrayDark, Color::GrayLight, Color::Green, Color::GreenLight, Color::Magenta, Color::MagentaLight, Color::Red, Color::RedLight, Color::SkyBlue1, Color::White, Color::Yellow, Color::YellowLight, ftxui
11
12 int main() {
13 using namespace ftxui;
14 auto document = hbox({
15 vbox({
16 color(Color::Default, text("Default")),
17 color(Color::Black, text("Black")),
18 color(Color::GrayDark, text("GrayDark")),
19 color(Color::GrayLight, text("GrayLight")),
20 color(Color::White, text("White")),
21 color(Color::Blue, text("Blue")),
22 color(Color::BlueLight, text("BlueLight")),
23 color(Color::Cyan, text("Cyan")),
24 color(Color::CyanLight, text("CyanLight")),
25 color(Color::Green, text("Green")),
26 color(Color::GreenLight, text("GreenLight")),
27 color(Color::Magenta, text("Magenta")),
28 color(Color::MagentaLight, text("MagentaLight")),
29 color(Color::Red, text("Red")),
30 color(Color::RedLight, text("RedLight")),
31 color(Color::Yellow, text("Yellow")),
32 color(Color::YellowLight, text("YellowLight")),
33 color(0x66ff66_rgb, text("Phosphor")),
34 color(LinearGradient(Color::SkyBlue1, Color::DeepSkyBlue4),
35 text("Skyblue to DeepSkyBlue")),
36 }),
37 vbox({
38 bgcolor(Color::Default, text("Default")),
39 bgcolor(Color::Black, text("Black")),
40 bgcolor(Color::GrayDark, text("GrayDark")),
41 bgcolor(Color::GrayLight, text("GrayLight")),
42 bgcolor(Color::White, text("White")),
43 bgcolor(Color::Blue, text("Blue")),
44 bgcolor(Color::BlueLight, text("BlueLight")),
45 bgcolor(Color::Cyan, text("Cyan")),
46 bgcolor(Color::CyanLight, text("CyanLight")),
47 bgcolor(Color::Green, text("Green")),
48 bgcolor(Color::GreenLight, text("GreenLight")),
49 bgcolor(Color::Magenta, text("Magenta")),
50 bgcolor(Color::MagentaLight, text("MagentaLight")),
51 bgcolor(Color::Red, text("Red")),
52 bgcolor(Color::RedLight, text("RedLight")),
53 bgcolor(Color::Yellow, text("Yellow")),
54 bgcolor(Color::YellowLight, text("YellowLight")),
55 bgcolor(0x66ff66_rgb, text("Phosphor")),
56 bgcolor(LinearGradient(Color::SkyBlue1, Color::DeepSkyBlue4),
57 text("Skyblue to DeepSkyBlue")),
58 }),
59 filler(),
60 });
61
62 auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
63 Render(screen, document);
64 screen.Print();
65
66 return 0;
67}
color.hpp
elements.hpp
ftxui::LinearGradient
A class representing the settings for linear-gradient color effect.
Definition linear_gradient.hpp:32
linear_gradient.hpp
ftxui
The FTXUI ftxui:: namespace.
Definition animation.hpp:10
node.hpp
screen.hpp
main
int main()
Definition style_color.cpp:12