diff options
| author | 2023-07-12 12:23:18 -0700 | |
|---|---|---|
| committer | 2023-07-12 12:23:18 -0700 | |
| commit | 633f405f3f78bc7f82d2b2061491b0e011137451 (patch) | |
| tree | 5ebfc1f45d216a5c14a90492563599e6969eab4d /core/src/background.rs | |
| parent | 41836dd80d0534608e7aedfbf2319c540a23de1a (diff) | |
| parent | 21bd51426d900e271206f314e0c915dd41065521 (diff) | |
| download | iced-633f405f3f78bc7f82d2b2061491b0e011137451.tar.gz iced-633f405f3f78bc7f82d2b2061491b0e011137451.tar.bz2 iced-633f405f3f78bc7f82d2b2061491b0e011137451.zip | |
Merge remote-tracking branch 'origin/master' into feat/multi-window-support
# Conflicts:
#	Cargo.toml
#	core/src/window/icon.rs
#	core/src/window/id.rs
#	core/src/window/position.rs
#	core/src/window/settings.rs
#	examples/integration/src/main.rs
#	examples/integration_opengl/src/main.rs
#	glutin/src/application.rs
#	native/src/subscription.rs
#	native/src/window.rs
#	runtime/src/window/action.rs
#	src/lib.rs
#	src/window.rs
#	winit/Cargo.toml
#	winit/src/application.rs
#	winit/src/icon.rs
#	winit/src/settings.rs
#	winit/src/window.rs
Diffstat (limited to 'core/src/background.rs')
| -rw-r--r-- | core/src/background.rs | 19 | 
1 files changed, 14 insertions, 5 deletions
| diff --git a/core/src/background.rs b/core/src/background.rs index cfb95867..347c52c0 100644 --- a/core/src/background.rs +++ b/core/src/background.rs @@ -1,11 +1,14 @@ +use crate::gradient::{self, Gradient};  use crate::Color;  /// 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 { @@ -14,8 +17,14 @@ impl From<Color> for Background {      }  } -impl From<Color> for Option<Background> { -    fn from(color: Color) -> Self { -        Some(Background::from(color)) +impl From<Gradient> for Background { +    fn from(gradient: Gradient) -> Self { +        Background::Gradient(gradient) +    } +} + +impl From<gradient::Linear> for Background { +    fn from(gradient: gradient::Linear) -> Self { +        Background::Gradient(Gradient::Linear(gradient))      }  } | 
