Description
The Colors
property of the Gradient
struct provides an immutable list of color stops, represented by ColorFrame
objects. These color stops define the colors at specific points in time within the gradient. The list should be ordered by time to ensure the gradient is evaluated correctly.
Usage
Use the Colors
property to access the list of color stops in a gradient. This property is read-only and returns an ImmutableList
of ColorFrame
objects. To modify the list, you will need to create a new Gradient
instance with the desired color frames.
Example
// Example of accessing the Colors property
Gradient gradient = new Gradient();
ImmutableList<Gradient.ColorFrame> colorFrames = gradient.Colors;
// Iterate through the color frames
foreach (var colorFrame in colorFrames)
{
Console.WriteLine($"Time: {colorFrame.Time}, Color: {colorFrame.Color}");
}