pub struct LinearGradient { /* private fields */ }Expand description
A linear-gradient(...) CSS value.
Implementations§
Source§impl LinearGradient
impl LinearGradient
Sourcepub fn new(angle: impl Into<Option<GradientAngle>>) -> Self
pub fn new(angle: impl Into<Option<GradientAngle>>) -> Self
Creates a new LinearGradient with the given direction/angle and no stops.
You must add stops with LinearGradient::add_stop before the gradient is usable.
A valid gradient needs at least two stops.
Sourcepub fn add_stop(self, offset: f32, color: impl Into<Option<Color>>) -> Self
pub fn add_stop(self, offset: f32, color: impl Into<Option<Color>>) -> Self
Add a stop to the gradient. It must have at least two stops to be valid. color: None is treated as currentColor
Sourcepub fn with_interpolation_space(self, cs: ColorSpaceTag) -> Self
pub fn with_interpolation_space(self, cs: ColorSpaceTag) -> Self
Sets the interpolation color space used when blending between stops.
Sourcepub fn with_hue_direction(self, dir: HueDirection) -> Self
pub fn with_hue_direction(self, dir: HueDirection) -> Self
Sets the hue interpolation direction used by hue-based color spaces.
Trait Implementations§
Source§impl Clone for LinearGradient
impl Clone for LinearGradient
Source§fn clone(&self) -> LinearGradient
fn clone(&self) -> LinearGradient
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LinearGradient
impl Debug for LinearGradient
Source§impl Display for LinearGradient
impl Display for LinearGradient
Source§impl PartialEq for LinearGradient
impl PartialEq for LinearGradient
Auto Trait Implementations§
impl Freeze for LinearGradient
impl RefUnwindSafe for LinearGradient
impl Send for LinearGradient
impl Sync for LinearGradient
impl Unpin for LinearGradient
impl UnsafeUnpin for LinearGradient
impl UnwindSafe for LinearGradient
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