16class BgColor :
public NodeDecorator {
22 if (color_.IsOpaque()) {
23 for (
int y = box_.y_min; y <= box_.y_max; ++y) {
24 for (
int x = box_.x_min; x <= box_.x_max; ++x) {
25 screen.PixelAt(x, y).background_color = color_;
29 for (
int y = box_.y_min; y <= box_.y_max; ++y) {
30 for (
int x = box_.x_min; x <= box_.x_max; ++x) {
42class FgColor :
public NodeDecorator {
48 if (color_.IsOpaque()) {
49 for (
int y = box_.y_min; y <= box_.y_max; ++y) {
50 for (
int x = box_.x_min; x <= box_.x_max; ++x) {
51 screen.PixelAt(x, y).foreground_color = color_;
55 for (
int y = box_.y_min; y <= box_.y_max; ++y) {
56 for (
int x = box_.x_min; x <= box_.x_max; ++x) {
82 return std::make_shared<FgColor>(std::move(
child),
color);
97 return std::make_shared<BgColor>(std::move(
child),
color);
A class representing terminal colors.
static Color Blend(const Color &lhs, const Color &rhs)
Blend two colors together using the alpha channel.
virtual void Render(Screen &screen)
Display an element on a ftxui::Screen.
Decorator bgcolor(Color)
Decorate using a background color.
std::function< Element(Element)> Decorator
std::shared_ptr< Node > Element
std::shared_ptr< T > Make(Args &&... args)
void Render(Screen &screen, const Element &element)
Display an element on a ftxui::Screen.
Decorator color(Color)
Decorate using a foreground color.