ftxui::LinearGradient
#include <ftxui/dom/linear_gradient.hpp>A class representing the settings for linear-gradient color effect.
Example:
LinearGradient()
.Angle(45)
.Stop(Color::Red, 0.0)
.Stop(Color::Green, 0.5)
.Stop(Color::Blue, 1.0);There are also shorthand constructors:
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
Summary
| Symbol | Description |
|---|---|
angle | |
stops | |
LinearGradient | Build the "empty" gradient. This is often followed by calls to LinearGradient::Angle() and LinearGradient::Stop(). Example: |
Angle | Set the angle of the gradient. |
Stop | Add a color stop to the gradient. |
Public Attributes
angle
float angle = 0.f;stops
std::vector< Stop > stops;Public Member Functions
LinearGradient
LinearGradient();Build the "empty" gradient. This is often followed by calls to LinearGradient::Angle() and LinearGradient::Stop(). Example:
auto gradient =
LinearGradient()
.Angle(45)
.Stop(Color::Red, 0.0)
.Stop(Color::Green, 0.5)
.Stop(Color::Blue, 1.0);;Examples: component/input_style, component/linear_gradient_gallery, dom/linear_gradient, dom/style_color
LinearGradient
LinearGradient(Color begin, Color end);Build a gradient with two colors.
Parameters:
begin: The color at the beginning of the gradient.end: The color at the end of the gradient.
Examples: component/input_style, component/linear_gradient_gallery, dom/linear_gradient, dom/style_color
LinearGradient
LinearGradient(float angle, Color begin, Color end);Build a gradient with two colors and an angle.
Parameters:
a: The angle of the gradient.begin: The color at the beginning of the gradient.end: The color at the end of the gradient.
Examples: component/input_style, component/linear_gradient_gallery, dom/linear_gradient, dom/style_color
Angle
LinearGradient & Angle(float angle);Set the angle of the gradient.
Parameters:
a: The angle of the gradient.
Returns: The gradient.
Stop
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.
Stop
LinearGradient & Stop(Color color);Add a color stop to the gradient.
Parameters:
c: The color of the stop.
Returns: The gradient.
Note
The position of the stop is interpolated from nearby stops.