Loading...
Searching...
No Matches
examples/dom/style_color.cpp
// Copyright 2020 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
#include <ftxui/dom/linear_gradient.hpp> // for LinearGradient
#include <ftxui/screen/screen.hpp> // for Full, Screen
#include <memory> // for allocator
#include "ftxui/dom/elements.hpp" // for text, bgcolor, color, vbox, filler, Fit, hbox
#include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/color.hpp" // for Color, operator""_rgb, Color::Black, Color::Blue, Color::BlueLight, Color::Cyan, Color::CyanLight, Color::DeepSkyBlue4, Color::Default, Color::GrayDark, Color::GrayLight, Color::Green, Color::GreenLight, Color::Magenta, Color::MagentaLight, Color::Red, Color::RedLight, Color::SkyBlue1, Color::White, Color::Yellow, Color::YellowLight, ftxui
int main() {
using namespace ftxui;
auto document = hbox({
vbox({
color(Color::Default, text("Default")),
color(Color::Black, text("Black")),
color(Color::GrayDark, text("GrayDark")),
color(Color::GrayLight, text("GrayLight")),
color(Color::White, text("White")),
color(Color::Blue, text("Blue")),
color(Color::BlueLight, text("BlueLight")),
color(Color::Cyan, text("Cyan")),
color(Color::CyanLight, text("CyanLight")),
color(Color::Green, text("Green")),
color(Color::GreenLight, text("GreenLight")),
color(Color::Magenta, text("Magenta")),
color(Color::MagentaLight, text("MagentaLight")),
color(Color::Red, text("Red")),
color(Color::RedLight, text("RedLight")),
color(Color::Yellow, text("Yellow")),
color(Color::YellowLight, text("YellowLight")),
color(0x66ff66_rgb, text("Phosphor")),
color(LinearGradient(Color::SkyBlue1, Color::DeepSkyBlue4),
text("Skyblue to DeepSkyBlue")),
}),
vbox({
bgcolor(Color::Default, text("Default")),
bgcolor(Color::Black, text("Black")),
bgcolor(Color::GrayDark, text("GrayDark")),
bgcolor(Color::GrayLight, text("GrayLight")),
bgcolor(Color::White, text("White")),
bgcolor(Color::Blue, text("Blue")),
bgcolor(Color::BlueLight, text("BlueLight")),
bgcolor(Color::Cyan, text("Cyan")),
bgcolor(Color::CyanLight, text("CyanLight")),
bgcolor(Color::Green, text("Green")),
bgcolor(Color::GreenLight, text("GreenLight")),
bgcolor(Color::Magenta, text("Magenta")),
bgcolor(Color::MagentaLight, text("MagentaLight")),
bgcolor(Color::Red, text("Red")),
bgcolor(Color::RedLight, text("RedLight")),
bgcolor(Color::Yellow, text("Yellow")),
bgcolor(Color::YellowLight, text("YellowLight")),
bgcolor(0x66ff66_rgb, text("Phosphor")),
bgcolor(LinearGradient(Color::SkyBlue1, Color::DeepSkyBlue4),
text("Skyblue to DeepSkyBlue")),
}),
filler(),
});
auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
Render(screen, document);
screen.Print();
return 0;
}
ftxui::Color::Default
@ Default
Definition color.hpp:48
ftxui::Color::DeepSkyBlue4
@ DeepSkyBlue4
Definition color.hpp:136
ftxui::Color::SkyBlue1
@ SkyBlue1
Definition color.hpp:281
ftxui::Color::RedLight
@ RedLight
Definition color.hpp:61
ftxui::Color::CyanLight
@ CyanLight
Definition color.hpp:66
ftxui::Color::YellowLight
@ YellowLight
Definition color.hpp:63
ftxui::Color::MagentaLight
@ MagentaLight
Definition color.hpp:65
ftxui::Color::GreenLight
@ GreenLight
Definition color.hpp:62
ftxui::Color::Cyan
@ Cyan
Definition color.hpp:58
ftxui::Color::Magenta
@ Magenta
Definition color.hpp:57
ftxui::Color::White
@ White
Definition color.hpp:67
ftxui::Color::Yellow
@ Yellow
Definition color.hpp:55
ftxui::Color::Black
@ Black
Definition color.hpp:52
ftxui::Color::Green
@ Green
Definition color.hpp:54
ftxui::Color::Red
@ Red
Definition color.hpp:53
ftxui::Color::GrayDark
@ GrayDark
Definition color.hpp:60
ftxui::Color::GrayLight
@ GrayLight
Definition color.hpp:59
ftxui::Color::Blue
@ Blue
Definition color.hpp:56
ftxui::Color::BlueLight
@ BlueLight
Definition color.hpp:64
ftxui::Screen::Create
static Screen Create(Dimensions dimension)
Create a screen with the given dimension.
Definition screen.cpp:394
color.hpp
elements.hpp
linear_gradient.hpp
ftxui::Dimension::Fit
Dimensions Fit(Element &, bool extend_beyond_screen=false)
Definition util.cpp:93
ftxui::Dimension::Full
Dimensions Full()
Definition screen.cpp:382
ftxui
Definition animation.hpp:10
ftxui::bgcolor
Decorator bgcolor(Color)
Decorate using a background color.
Definition color.cpp:124
ftxui::hbox
Element hbox(Elements)
A container displaying elements horizontally one by one.
Definition hbox.cpp:94
ftxui::text
Element text(std::wstring text)
Display a piece of unicode text.
Definition text.cpp:160
ftxui::filler
Element filler()
An element that will take expand proportionally to the space left in a container.
Definition flex.cpp:98
ftxui::Render
void Render(Screen &screen, const Element &element)
Display an element on a ftxui::Screen.
Definition node.cpp:88
ftxui::color
Decorator color(Color)
Decorate using a foreground color.
Definition color.cpp:110
ftxui::vbox
Element vbox(Elements)
A container displaying elements vertically one by one.
Definition vbox.cpp:96
node.hpp
screen.hpp
ftxui::LinearGradient
A class representing the settings for linear-gradient color effect.
Definition linear_gradient.hpp:30