FTXUI 6.1.9
C++ functional terminal UI.
载入中...
搜索中...
未找到
style_gallery.cpp
浏览该文件的文档.
1// 版权所有 2020 Arthur Sonzogni. 保留所有权利。
2// 本源代码的使用受 MIT 许可证的约束,该许可证可在
3// LICENSE 文件中找到。
4#include <ftxui/dom/elements.hpp> // for text, operator|, Element, bgcolor, color, blink, bold, dim, inverted, underlined, Fit, hbox
5#include <ftxui/screen/screen.hpp> // for Full, Screen
6#include <memory> // for allocator
7
8#include "ftxui/dom/node.hpp" // for Render
9#include "ftxui/screen/color.hpp" // for Color, Color::Blue, ftxui
10
11int main() {
12 using namespace ftxui;
13 // clang-format off
14 auto document =
15 hbox({
16 text("normal") , text(" ") ,
17 text("bold") | bold , text(" ") ,
18 text("italic") | italic , text(" ") ,
19 text("dim") | dim , text(" ") ,
20 text("inverted") | inverted , text(" ") ,
21 text("underlined") | underlined , text(" ") ,
22 text("underlinedDouble") | underlinedDouble , text(" ") ,
23 text("blink") | blink , text(" ") ,
24 text("strikethrough") | strikethrough , text(" ") ,
25 text("color") | color(Color::Blue) , text(" ") ,
26 text("bgcolor") | bgcolor(Color::Blue) , text(" ") ,
27 text("hyperlink") | hyperlink("https://github.com/ArthurSonzogni/FTXUI"),
28 });
29 // clang-format on
30 auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
31 Render(screen, document);
32 screen.Print();
33
34 return 0;
35}
Element color(const LinearGradient &gradient, Element child)
使用线性渐变效果设置元素的前景色。
Element bgcolor(const LinearGradient &gradient, Element child)
使用线性渐变效果设置元素的背景色。
#include "ftxui/component/component_base.hpp" // 用于 ComponentBase