Loading...
Searching...
No Matches
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:
| 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.
LinearGradient & | Angle (float angle)
| Set the angle of the gradient.
LinearGradient & | Stop (Color color, float position)
| Add a color stop to the gradient.
LinearGradient & | Stop (Color color)
| Add a color stop to the gradient.

## Data Fields

float | angle = 0.f
std::vector< Stop > | stops

## Detailed Description

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);
ftxui::Color::Green
@ Green
Definition color.hpp:54
ftxui::Color::Red
@ Red
Definition color.hpp:53
ftxui::Color::Blue
@ Blue
Definition color.hpp:56
ftxui::LinearGradient::LinearGradient
LinearGradient()
Build the "empty" gradient. This is often followed by calls to LinearGradient::Angle() and LinearGrad...

There are also shorthand constructors:

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

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

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 = Color::Default |
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 =
LinearGradient()
.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

  begin | The color at the beginning of the gradient.
  end | The color at the end of the gradient.

Definition at line 199 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

  a | The angle of the gradient.
  begin | The color at the beginning of the gradient.
  end | The color at the end of the gradient.

Definition at line 207 of file linear_gradient.cpp.

## Member Function Documentation

## Angle()

LinearGradient & Angle | ( | float | a | ) |

Set the angle of the gradient.

Parameters

  a | The angle of the gradient.

Returns
  The gradient.

Definition at line 216 of file linear_gradient.cpp.

## Stop() [1/2]

LinearGradient & Stop | ( | Color | c,
|  | float | p )

Add a color stop to the gradient.

Parameters

  c | The color of the stop.
  p | The position of the stop.

Returns
  The gradient.

Definition at line 225 of file linear_gradient.cpp.

## Stop() [2/2]

LinearGradient & Stop | ( | Color | c | ) |

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.

Definition at line 235 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:

- include/ftxui/dom/linear_gradient.hpp
- src/ftxui/dom/linear_gradient.cpp