summaryrefslogtreecommitdiffstats
path: root/src/widget/text.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-08-26 04:07:52 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2019-08-26 04:07:52 +0200
commitee2d40d77f6ac3a7f6e72163d484f2801e4922fe (patch)
treea47cc74aee303df0f4a1a363af364464fb9fd979 /src/widget/text.rs
parent8879ccb5f502e2a8ec449486f718e8bd9b2f7a0a (diff)
downloadiced-ee2d40d77f6ac3a7f6e72163d484f2801e4922fe.tar.gz
iced-ee2d40d77f6ac3a7f6e72163d484f2801e4922fe.tar.bz2
iced-ee2d40d77f6ac3a7f6e72163d484f2801e4922fe.zip
Make `Color` optional instead of `Default`
Diffstat (limited to '')
-rw-r--r--src/widget/text.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/widget/text.rs b/src/widget/text.rs
index bf5c1624..018c7cc5 100644
--- a/src/widget/text.rs
+++ b/src/widget/text.rs
@@ -27,16 +27,13 @@ use std::hash::Hash;
pub struct Text<Color> {
content: String,
size: u16,
- color: Color,
+ color: Option<Color>,
style: Style,
horizontal_alignment: HorizontalAlignment,
vertical_alignment: VerticalAlignment,
}
-impl<Color> Text<Color>
-where
- Color: Default,
-{
+impl<Color> Text<Color> {
/// Create a new fragment of [`Text`] with the given contents.
///
/// [`Text`]: struct.Text.html
@@ -44,7 +41,7 @@ where
Text {
content: String::from(label),
size: 20,
- color: Color::default(),
+ color: None,
style: Style::default().fill_width(),
horizontal_alignment: HorizontalAlignment::Left,
vertical_alignment: VerticalAlignment::Top,
@@ -64,7 +61,7 @@ where
/// [`Text`]: struct.Text.html
/// [`Color`]: ../../../graphics/struct.Color.html
pub fn color(mut self, color: Color) -> Self {
- self.color = color;
+ self.color = Some(color);
self
}
@@ -180,7 +177,7 @@ pub trait Renderer<Color> {
bounds: Rectangle<f32>,
content: &str,
size: f32,
- color: Color,
+ color: Option<Color>,
horizontal_alignment: HorizontalAlignment,
vertical_alignment: VerticalAlignment,
);