Add impl From<Color> for Gradient

This commit is contained in:
Ivan Molodetskikh
2025-02-02 08:41:42 +03:00
parent 019e75955d
commit d5592743cb
2 changed files with 14 additions and 8 deletions
+12
View File
@@ -530,6 +530,18 @@ pub struct Gradient {
pub in_: GradientInterpolation,
}
impl From<Color> for Gradient {
fn from(value: Color) -> Self {
Self {
from: value,
to: value,
angle: 0,
relative_to: GradientRelativeTo::Window,
in_: GradientInterpolation::default(),
}
}
}
#[derive(knuffel::DecodeScalar, Debug, Default, Clone, Copy, PartialEq, Eq)]
pub enum GradientRelativeTo {
#[default]