Skip to content
You are viewing documentation for v6.1.2. Switch to latest (main).

ftxui::LinearGradient ​

cpp
#include <ftxui/dom/linear_gradient.hpp>

A class representing the settings for linear-gradient color effect.

Example:

cpp
LinearGradient()
   .Angle(45)
   .Stop(Color::Red, 0.0)
   .Stop(Color::Green, 0.5)
   .Stop(Color::Blue, 1.0);

There are also shorthand constructors:

cpp
LinearGradient(Color::Red, Color::Blue);
LinearGradient(45, Color::Red, Color::Blue);

Examples: component/input_style, component/linear_gradient_gallery, dom/linear_gradient, dom/style_color

Public Attributes ​

angle ​

cpp
float angle = 0.f;

stops ​

cpp
std::vector< Stop > stops;

Public Member Functions ​

Stop ​

cpp
LinearGradient & Stop(Color color, float position);

Add a color stop to the gradient.

Parameters:

  • c: The color of the stop.
  • p: The position of the stop.

Returns: The gradient.

Examples: component/linear_gradient_gallery, dom/linear_gradient