diff options
Diffstat (limited to 'core/src/background.rs')
-rw-r--r-- | core/src/background.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/core/src/background.rs b/core/src/background.rs index cfb95867..6af33c3e 100644 --- a/core/src/background.rs +++ b/core/src/background.rs @@ -1,11 +1,13 @@ -use crate::Color; +use crate::{Color, Gradient}; /// The background of some element. #[derive(Debug, Clone, Copy, PartialEq)] pub enum Background { - /// A solid color + /// A solid color. Color(Color), - // TODO: Add gradient and image variants + /// Linearly interpolate between several colors. + Gradient(Gradient), + // TODO: Add image variant } impl From<Color> for Background { @@ -19,3 +21,9 @@ impl From<Color> for Option<Background> { Some(Background::from(color)) } } + +impl From<Gradient> for Option<Background> { + fn from(gradient: Gradient) -> Self { + Some(Background::Gradient(gradient)) + } +} |