summaryrefslogtreecommitdiffstats
path: root/widget
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-12 16:52:53 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-12 16:52:53 +0100
commit98621aa344a7a0e1b23f320d21a4687af559998e (patch)
tree4acb46e00ef3037aad6a8273ab67d4278d560784 /widget
parentb721fd935c6b689b1365e21dfc864e43bf3a5895 (diff)
downloadiced-98621aa344a7a0e1b23f320d21a4687af559998e.tar.gz
iced-98621aa344a7a0e1b23f320d21a4687af559998e.tar.bz2
iced-98621aa344a7a0e1b23f320d21a4687af559998e.zip
Remove `themer` use from `gradient` example :tada:
Diffstat (limited to 'widget')
-rw-r--r--widget/src/container.rs24
1 files changed, 21 insertions, 3 deletions
diff --git a/widget/src/container.rs b/widget/src/container.rs
index f51ff878..7c133588 100644
--- a/widget/src/container.rs
+++ b/widget/src/container.rs
@@ -539,6 +539,24 @@ impl Appearance {
}
}
+impl From<Color> for Appearance {
+ fn from(color: Color) -> Self {
+ Self::default().with_background(color)
+ }
+}
+
+impl From<Gradient> for Appearance {
+ fn from(gradient: Gradient) -> Self {
+ Self::default().with_background(gradient)
+ }
+}
+
+impl From<gradient::Linear> for Appearance {
+ fn from(gradient: gradient::Linear) -> Self {
+ Self::default().with_background(gradient)
+ }
+}
+
/// The possible status of a [`Container`].
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Status {
@@ -571,19 +589,19 @@ impl DefaultStyle for Appearance {
impl DefaultStyle for Color {
fn default_style(&self, _status: Status) -> Appearance {
- Appearance::default().with_background(*self)
+ Appearance::from(*self)
}
}
impl DefaultStyle for Gradient {
fn default_style(&self, _status: Status) -> Appearance {
- Appearance::default().with_background(*self)
+ Appearance::from(*self)
}
}
impl DefaultStyle for gradient::Linear {
fn default_style(&self, _status: Status) -> Appearance {
- Appearance::default().with_background(*self)
+ Appearance::from(*self)
}
}