examples/component/slider_rgb.cpp

    //Copyright2020ArthurSonzogni.Allrightsreserved.
    //UseofthissourcecodeisgovernedbytheMITlicensethatcanbefoundin
    //theLICENSEfile.
    #include<memory>//forallocator,shared_ptr,__shared_ptr_access
    #include<string>//forchar_traits,operator+,to_string

    #include"ftxui/component/captured_mouse.hpp"//forftxui
    #include"ftxui/component/component.hpp"//forSlider,Renderer,Vertical
    #include"ftxui/component/component_base.hpp"//forComponentBase
    #include"ftxui/component/screen_interactive.hpp"//forScreenInteractive
    #include"ftxui/dom/elements.hpp"//forseparator,operator|,Element,size,text,vbox,xflex,bgcolor,hbox,GREATER_THAN,WIDTH,border,HEIGHT,LESS_THAN
    #include"ftxui/screen/color.hpp"//forColor

    usingnamespaceftxui;

    ElementColorTile(intred,intgreen,intblue){
    returntext("")|size(WIDTH,GREATER_THAN,14)|
    size(HEIGHT,GREATER_THAN,7)|bgcolor(Color::RGB(red,green,blue));
    }

    ElementColorString(intred,intgreen,intblue){
    returntext("RGB=("+//
    std::to_string(red)+","+//
    std::to_string(green)+","+//
    std::to_string(blue)+")"//
    );
    }

    intmain(){
    intred=128;
    intgreen=25;
    intblue=100;
    autoslider_red=Slider("Red:",&red,0,255,1);
    autoslider_green=Slider("Green:",&green,0,255,1);
    autoslider_blue=Slider("Blue:",&blue,0,255,1);

    autocontainer=Container::Vertical({
    slider_red,
    slider_green,
    slider_blue,
    });

    autorenderer=Renderer(container,[&]{
    returnhbox({
    ColorTile(red,green,blue),
    separator(),
    vbox({
    slider_red->Render(),
    separator(),
    slider_green->Render(),
    separator(),
    slider_blue->Render(),
    separator(),
    ColorString(red,green,blue),
    })|xflex,
    })|
    border|size(WIDTH,LESS_THAN,80);
    });
    autoscreen=ScreenInteractive::TerminalOutput();
    screen.Loop(renderer);
    }