examples/component/linear_gradient_gallery.cpp

    //Copyright2023ArthurSonzogni.Allrightsreserved.
    //UseofthissourcecodeisgovernedbytheMITlicensethatcanbefoundin
    //theLICENSEfile.
    #include<ftxui/component/component_base.hpp>//forComponentBase,Component
    #include<ftxui/dom/elements.hpp>//foroperator|,Element,flex,bgcolor,text,vbox,center
    #include<ftxui/dom/linear_gradient.hpp>//forLinearGradient
    #include<ftxui/screen/color.hpp>//forColor,Color::Blue,Color::Red
    #include<memory>//for__shared_ptr_access,shared_ptr
    #include<string>//forallocator,operator+,char_traits,string,to_string

    #include"ftxui/component/captured_mouse.hpp"//forftxui
    #include"ftxui/component/component.hpp"//forSlider,Renderer,Vertical
    #include"ftxui/component/screen_interactive.hpp"//forScreenInteractive

    intmain(){
    usingnamespaceftxui;
    autoscreen=ScreenInteractive::Fullscreen();

    intangle=180.f;
    floatstart=0.f;
    floatend=1.f;

    std::stringslider_angle_text;
    std::stringslider_start_text;
    std::stringslider_end_text;

    autoslider_angle=Slider(&slider_angle_text,&angle,0,360);
    autoslider_start=Slider(&slider_start_text,&start,0.f,1.f,0.05f);
    autoslider_end=Slider(&slider_end_text,&end,0.f,1.f,0.05f);

    autolayout=Container::Vertical({
    slider_angle,
    slider_start,
    slider_end,
    });

    autorenderer=Renderer(layout,[&]{
    slider_angle_text="angle="+std::to_string(angle)+"°";
    slider_start_text="start="+std::to_string(int(start*100))+"%";
    slider_end_text="end="+std::to_string(int(end*100))+"%";

    autobackground=text("Gradient")|center|
    bgcolor(LinearGradient()
    .Angle(angle)
    .Stop(Color::Blue,start)
    .Stop(Color::Red,end));
    returnvbox({
    background|flex,
    layout->Render(),
    })|
    flex;
    });

    screen.Loop(renderer);
    }