pub enum Gradient {
Linear {
direction: LinearDirection,
stops: Vec<ColorStop>,
},
Radial {
shape: RadialShape,
stops: Vec<ColorStop>,
},
Conic {
from: Option<Angle>,
at: Option<(LengthPercentage, LengthPercentage)>,
stops: Vec<ColorStop>,
},
}Expand description
A CSS <gradient> value.
Variants§
Linear
linear-gradient(<direction>, <stops>).
Fields
§
direction: LinearDirectionDirection of the gradient axis.
Radial
radial-gradient(<shape>, <stops>).
Fields
§
shape: RadialShapeShape and extent of the radial gradient.
Conic
conic-gradient([from <angle>] [at <position>], <stops>).
Fields
§
at: Option<(LengthPercentage, LengthPercentage)>Center of the sweep as <length-percentage> <length-percentage>
(defaults to 50% 50% when None).
Implementations§
Source§impl Gradient
impl Gradient
Sourcepub fn linear_to_bottom(stops: impl IntoIterator<Item = ColorStop>) -> Self
pub fn linear_to_bottom(stops: impl IntoIterator<Item = ColorStop>) -> Self
Convenience constructor for a vertical top-to-bottom linear gradient with the given color stops.
Sourcepub fn linear_to_right(stops: impl IntoIterator<Item = ColorStop>) -> Self
pub fn linear_to_right(stops: impl IntoIterator<Item = ColorStop>) -> Self
Convenience constructor for a horizontal left-to-right linear gradient with the given color stops.
Trait Implementations§
impl StructuralPartialEq for Gradient
Auto Trait Implementations§
impl Freeze for Gradient
impl RefUnwindSafe for Gradient
impl Send for Gradient
impl Sync for Gradient
impl Unpin for Gradient
impl UnsafeUnpin for Gradient
impl UnwindSafe for Gradient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more