22 return text(
"RGB = (" +
23 std::to_string(red) +
"," +
24 std::to_string(green) +
"," +
25 std::to_string(blue) +
")"
33 auto slider_red =
Slider(
"Red :", &red, 0, 255, 1);
34 auto slider_green =
Slider(
"Green:", &green, 0, 255, 1);
35 auto slider_blue =
Slider(
"Blue :", &blue, 0, 255, 1);
37 auto container = Container::Vertical({
43 auto renderer =
Renderer(container, [&] {
50 slider_green->Render(),
52 slider_blue->Render(),
59 auto screen = App::TerminalOutput();
60 screen.Loop(renderer);
Component Renderer(Component child, std::function< Element()>)
回傳一個新的 Component,類似 |child|,但使用 |render| 作為 Component::Render() 事件。
Element text(std::string_view text)
顯示一段 UTF8 編碼的 Unicode 文字。
Decorator size(WidthOrHeight direction, Constraint constraint, int value)
對元素的大小套用限制。
Element bgcolor(Color color, Element child)
設定元素的背景顏色。
Element separator()
在兩個元素之間繪製垂直或水平分隔線。
Element vbox(Elements children)
一個垂直一個接一個顯示元素的容器。
std::shared_ptr< Node > Element
Element hbox(Elements children)
一個逐一水平顯示元素的容器。
Component Slider(SliderOption< T > options)
任意方向的滑桿。
Element ColorTile(int red, int green, int blue)
Element ColorString(int red, int green, int blue)