FTXUI 6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
LinearGradient Struct Reference

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

#include <linear_gradient.hpp>

Data Structures

struct  Stop
 

Public Member Functions

 LinearGradient ()
 Build the "empty" gradient. This is often followed by calls to LinearGradient::Angle() and LinearGradient::Stop(). Example:
 
 LinearGradient (Color begin, Color end)
 Build a gradient with two colors.
 
 LinearGradient (float angle, Color begin, Color end)
 Build a gradient with two colors and an angle.
 
LinearGradientAngle (float angle)
 Set the angle of the gradient.
 
LinearGradientStop (Color color, float position)
 Add a color stop to the gradient.
 
LinearGradientStop (Color color)
 Add a color stop to the gradient.
 

Data Fields

float angle = 0.f
 
std::vector< Stopstops
 

Detailed Description

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

Example:

.Angle(45)
.Stop(Color::Red, 0.0)
.Stop(Color::Green, 0.5)
.Stop(Color::Blue, 1.0);
LinearGradient()
Build the "empty" gradient. This is often followed by calls to LinearGradient::Angle() and LinearGrad...

There are also shorthand constructors:

Examples
examples/component/input_in_frame.cpp, examples/component/input_style.cpp, examples/component/linear_gradient_gallery.cpp, examples/dom/html_like.cpp, examples/dom/linear_gradient.cpp, examples/dom/style_bold.cpp, and examples/dom/style_color.cpp.

Definition at line 30 of file linear_gradient.hpp.

Constructor & Destructor Documentation

◆ LinearGradient() [1/3]

LinearGradient ( )
default

Build the "empty" gradient. This is often followed by calls to LinearGradient::Angle() and LinearGradient::Stop(). Example:

auto gradient =
.Angle(45)
.Stop(Color::Red, 0.0)
.Stop(Color::Green, 0.5)
.Stop(Color::Blue, 1.0);;

◆ LinearGradient() [2/3]

LinearGradient ( Color begin,
Color end )

Build a gradient with two colors.

Parameters
beginThe color at the beginning of the gradient.
endThe color at the end of the gradient.

Definition at line 199 of file src/ftxui/dom/linear_gradient.cpp.

◆ LinearGradient() [3/3]

LinearGradient ( float a,
Color begin,
Color end )

Build a gradient with two colors and an angle.

Parameters
aThe angle of the gradient.
beginThe color at the beginning of the gradient.
endThe color at the end of the gradient.

Definition at line 207 of file src/ftxui/dom/linear_gradient.cpp.

Member Function Documentation

◆ Angle()

LinearGradient & Angle ( float a)

Set the angle of the gradient.

Parameters
aThe angle of the gradient.
Returns
The gradient.

Definition at line 216 of file src/ftxui/dom/linear_gradient.cpp.

◆ Stop() [1/2]

LinearGradient & Stop ( Color c,
float p )

Add a color stop to the gradient.

Parameters
cThe color of the stop.
pThe position of the stop.
Returns
The gradient.

Definition at line 225 of file src/ftxui/dom/linear_gradient.cpp.

◆ Stop() [2/2]

LinearGradient & Stop ( Color c)

Add a color stop to the gradient.

Parameters
cThe color of the stop.
Returns
The gradient.
Note
The position of the stop is interpolated from nearby stops.

Definition at line 235 of file src/ftxui/dom/linear_gradient.cpp.

Field Documentation

◆ angle

float angle = 0.f

Definition at line 31 of file linear_gradient.hpp.

◆ stops

std::vector<Stop> stops

Definition at line 36 of file linear_gradient.hpp.


The documentation for this struct was generated from the following files: