pub type Gradient = Gradient<LineDirection, LengthPercentage, NonNegativeLength, NonNegativeLengthPercentage, Position, Angle, AngleOrPercentage, Color>;
Expand description
Specified values for a CSS gradient. https://drafts.csswg.org/css-images/#gradients
Aliased Type§
enum Gradient {
Linear {
direction: LineDirection,
color_interpolation_method: ColorInterpolationMethod,
items: OwnedSlice<GenericGradientItem<Color, LengthPercentage>>,
flags: GradientFlags,
compat_mode: GradientCompatMode,
},
Radial {
shape: GenericEndingShape<NonNegative<Length>, NonNegative<LengthPercentage>>,
position: GenericPosition<PositionComponent<HorizontalPositionKeyword>, PositionComponent<VerticalPositionKeyword>>,
color_interpolation_method: ColorInterpolationMethod,
items: OwnedSlice<GenericGradientItem<Color, LengthPercentage>>,
flags: GradientFlags,
compat_mode: GradientCompatMode,
},
Conic {
angle: Angle,
position: GenericPosition<PositionComponent<HorizontalPositionKeyword>, PositionComponent<VerticalPositionKeyword>>,
color_interpolation_method: ColorInterpolationMethod,
items: OwnedSlice<GenericGradientItem<Color, AngleOrPercentage>>,
flags: GradientFlags,
},
}
Variants§
Linear
A linear gradient.
Fields
direction: LineDirection
Line direction
color_interpolation_method: ColorInterpolationMethod
Method to use for color interpolation.
items: OwnedSlice<GenericGradientItem<Color, LengthPercentage>>
The color stops and interpolation hints.
flags: GradientFlags
State flags for the gradient.
compat_mode: GradientCompatMode
Compatibility mode.
Radial
A radial gradient.
Fields
shape: GenericEndingShape<NonNegative<Length>, NonNegative<LengthPercentage>>
Shape of gradient
position: GenericPosition<PositionComponent<HorizontalPositionKeyword>, PositionComponent<VerticalPositionKeyword>>
Center of gradient
color_interpolation_method: ColorInterpolationMethod
Method to use for color interpolation.
items: OwnedSlice<GenericGradientItem<Color, LengthPercentage>>
The color stops and interpolation hints.
flags: GradientFlags
State flags for the gradient.
compat_mode: GradientCompatMode
Compatibility mode.
Conic
A conic gradient.
Fields
position: GenericPosition<PositionComponent<HorizontalPositionKeyword>, PositionComponent<VerticalPositionKeyword>>
Center of gradient
color_interpolation_method: ColorInterpolationMethod
Method to use for color interpolation.
items: OwnedSlice<GenericGradientItem<Color, AngleOrPercentage>>
The color stops and interpolation hints.
flags: GradientFlags
State flags for the gradient.
Implementations§
source§impl Gradient
impl Gradient
fn parse_webkit_gradient_argument<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, ) -> Result<Self, ParseError<'i>>
fn parse_webkit_gradient_stops<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, reverse_stops: bool, ) -> Result<OwnedSlice<GradientItem<Color, LengthPercentage>>, ParseError<'i>>
sourcefn parse_stops<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
) -> Result<OwnedSlice<GradientItem<Color, LengthPercentage>>, ParseError<'i>>
fn parse_stops<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, ) -> Result<OwnedSlice<GradientItem<Color, LengthPercentage>>, ParseError<'i>>
Not used for -webkit-gradient syntax and conic-gradient
sourcefn try_parse_color_interpolation_method<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
) -> Option<ColorInterpolationMethod>
fn try_parse_color_interpolation_method<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, ) -> Option<ColorInterpolationMethod>
Try to parse a color interpolation method.
sourcefn parse_linear<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
repeating: bool,
compat_mode: GradientCompatMode,
) -> Result<Self, ParseError<'i>>
fn parse_linear<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, repeating: bool, compat_mode: GradientCompatMode, ) -> Result<Self, ParseError<'i>>
Parses a linear gradient.
GradientCompatMode can change during -moz-
prefixed gradient parsing if it come across a to
keyword.
sourcefn parse_radial<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
repeating: bool,
compat_mode: GradientCompatMode,
) -> Result<Self, ParseError<'i>>
fn parse_radial<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, repeating: bool, compat_mode: GradientCompatMode, ) -> Result<Self, ParseError<'i>>
Parses a radial gradient.
sourcefn parse_conic<'i, 't>(
context: &ParserContext<'_>,
input: &mut Parser<'i, 't>,
repeating: bool,
) -> Result<Self, ParseError<'i>>
fn parse_conic<'i, 't>( context: &ParserContext<'_>, input: &mut Parser<'i, 't>, repeating: bool, ) -> Result<Self, ParseError<'i>>
Parse a conic gradient.