FTXUI 6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
color_truecolor_RGB.cpp
Go to the documentation of this file.
1// Copyright 2020 Arthur Sonzogni. 全著作権所有。
2// このソースコードの使用は、
3// LICENSEファイルにあるMITライセンスに準拠します。
4#include <ftxui/dom/elements.hpp> // for hbox, text, bgcolor, operator|, vbox, Elements, window, Element, Fit
5#include <ftxui/screen/screen.hpp> // for Full, Screen
6#include <memory> // for allocator
7#include <utility> // for move
8
9#include "ftxui/dom/node.hpp" // for Render
10#include "ftxui/screen/color.hpp" // for Color, ftxui
11
12int main() {
13 using namespace ftxui;
14
15 Elements red_line;
16 Elements green_line;
17 Elements blue_line;
18 Elements cyan_line;
19 Elements magenta_line;
20 Elements yellow_line;
21
22 for (int value = 0; value < 255; value += 3) {
23 int v = value * value / 255;
24 red_line.push_back(text(" ") | bgcolor(Color::RGB(v, 0, 0)));
25 green_line.push_back(text(" ") | bgcolor(Color::RGB(0, v, 0)));
26 blue_line.push_back(text(" ") | bgcolor(Color::RGB(0, 0, v)));
27 cyan_line.push_back(text(" ") | bgcolor(Color::RGB(0, v, v)));
28 magenta_line.push_back(text(" ") | bgcolor(Color::RGB(v, 0, v)));
29 yellow_line.push_back(text(" ") | bgcolor(Color::RGB(v, v, 0)));
30 }
31
32 auto document = vbox({
33 window(text("原色"),
34 vbox({
35 hbox({text("赤色線 :"), hbox(std::move(red_line))}),
36 hbox({text("緑色線 :"), hbox(std::move(green_line))}),
37 hbox({text("青色線 :"), hbox(std::move(blue_line))}),
38 })),
39 window(text("二次色"),
40 vbox({
41 hbox({text("シアン線 :"), hbox(std::move(cyan_line))}),
42 hbox({text("マゼンタ線:"), hbox(std::move(magenta_line))}),
43 hbox({text("黄色線 :"), hbox(std::move(yellow_line))}),
44 })),
45 });
46
47 auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
48 Render(screen, document);
49
50 screen.Print();
51
52 return 0;
53}
int main()
Element window(Element title, Element content, BorderStyle border)
要素の周囲にタイトルとボーダーを持つウィンドウを描画します。
FTXUI ftxui:: 名前空間
Definition animation.hpp:9
std::vector< Element > Elements
Definition elements.hpp:22