FTXUI 6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
style_color.cpp
Go to the documentation of this file.
1// 版權所有 2020 Arthur Sonzogni。保留所有權利。
2// 本源代碼受 MIT 許可證約束,該許可證可在 LICENSE 文件中找到。
3#include <ftxui/dom/linear_gradient.hpp> // for LinearGradient
4#include <ftxui/screen/screen.hpp> // for Full, Screen
5#include <memory> // for allocator
6
7#include "ftxui/dom/elements.hpp" // for text, bgcolor, color, vbox, filler, Fit, hbox
8#include "ftxui/dom/node.hpp" // for Render
9#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
10
11int main() {
12 using namespace ftxui;
13 auto document = hbox({
14 vbox({
15 color(Color::Default, text("Default")),
16 color(Color::Black, text("Black")),
17 color(Color::GrayDark, text("GrayDark")),
18 color(Color::GrayLight, text("GrayLight")),
19 color(Color::White, text("White")),
20 color(Color::Blue, text("Blue")),
21 color(Color::BlueLight, text("BlueLight")),
22 color(Color::Cyan, text("Cyan")),
23 color(Color::CyanLight, text("CyanLight")),
24 color(Color::Green, text("Green")),
25 color(Color::GreenLight, text("GreenLight")),
26 color(Color::Magenta, text("Magenta")),
27 color(Color::MagentaLight, text("MagentaLight")),
28 color(Color::Red, text("Red")),
29 color(Color::RedLight, text("RedLight")),
30 color(Color::Yellow, text("Yellow")),
31 color(Color::YellowLight, text("YellowLight")),
32 color(0x66ff66_rgb, text("Phosphor")),
33 color(LinearGradient(Color::SkyBlue1, Color::DeepSkyBlue4),
34 text("Skyblue to DeepSkyBlue")),
35 }),
36 vbox({
37 bgcolor(Color::Default, text("Default")),
38 bgcolor(Color::Black, text("Black")),
39 bgcolor(Color::GrayDark, text("GrayDark")),
40 bgcolor(Color::GrayLight, text("GrayLight")),
41 bgcolor(Color::White, text("White")),
42 bgcolor(Color::Blue, text("Blue")),
43 bgcolor(Color::BlueLight, text("BlueLight")),
44 bgcolor(Color::Cyan, text("Cyan")),
45 bgcolor(Color::CyanLight, text("CyanLight")),
46 bgcolor(Color::Green, text("Green")),
47 bgcolor(Color::GreenLight, text("GreenLight")),
48 bgcolor(Color::Magenta, text("Magenta")),
49 bgcolor(Color::MagentaLight, text("MagentaLight")),
50 bgcolor(Color::Red, text("Red")),
51 bgcolor(Color::RedLight, text("RedLight")),
52 bgcolor(Color::Yellow, text("Yellow")),
53 bgcolor(Color::YellowLight, text("YellowLight")),
54 bgcolor(0x66ff66_rgb, text("Phosphor")),
55 bgcolor(LinearGradient(Color::SkyBlue1, Color::DeepSkyBlue4),
56 text("Skyblue to DeepSkyBlue")),
57 }),
58 filler(),
59 });
60
61 auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
62 Render(screen, document);
63 screen.Print();
64
65 return 0;
66}
void Render(Screen &screen, const Element &element)
在 ftxui::Screen 上顯示元素。
Definition node.cpp:82
表示線性漸變顏色效果設定的類別。
FTXUI 的 ftxui:: 命名空間
Definition animation.hpp:10
int main()