FTXUI  5.0.0
C++ functional terminal UI.
LinearGradient Struct Reference

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

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: More...
 
 LinearGradient (Color begin, Color end)
 Build a gradient with two colors. More...
 
 LinearGradient (float angle, Color begin, Color end)
 Build a gradient with two colors and an angle. More...
 
LinearGradientAngle (float angle)
 Set the angle of the gradient. More...
 
LinearGradientStop (Color color, float position)
 Add a color stop to the gradient. More...
 
LinearGradientStop (Color color)
 Add a color stop to the gradient. More...
 

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:

Definition at line 30 of file linear_gradient.hpp.


Data Structure Documentation

◆ ftxui::LinearGradient::Stop

struct ftxui::LinearGradient::Stop

Definition at line 32 of file linear_gradient.hpp.

Data Fields
Color color
optional< float > position

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 195 of file 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 203 of file 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 212 of file 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 221 of file linear_gradient.cpp.

◆ Stop() [2/2]

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 231 of file 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: