diff options
author | 2021-07-22 20:13:14 +0700 | |
---|---|---|
committer | 2021-07-22 20:22:32 +0700 | |
commit | 1b3606884747374f1e5599e3c783f36a2f2cac6f (patch) | |
tree | 77f8b39ff3b9ce0f3321cc5f58d10b27d61b96f8 /graphics | |
parent | 26b2a824a930b8f98f4510aa2d2f3aaef7b669b9 (diff) | |
download | iced-1b3606884747374f1e5599e3c783f36a2f2cac6f.tar.gz iced-1b3606884747374f1e5599e3c783f36a2f2cac6f.tar.bz2 iced-1b3606884747374f1e5599e3c783f36a2f2cac6f.zip |
Introduce `placeholder_color` to `pick_list::Style`
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/src/widget/pick_list.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/graphics/src/widget/pick_list.rs b/graphics/src/widget/pick_list.rs index a7fe3e93..01283bd5 100644 --- a/graphics/src/widget/pick_list.rs +++ b/graphics/src/widget/pick_list.rs @@ -38,6 +38,7 @@ where style: &Box<dyn StyleSheet>, ) -> Self::Output { let is_mouse_over = bounds.contains(cursor_position); + let is_selected = selected.is_some(); let style = if is_mouse_over { style.hovered() @@ -74,7 +75,9 @@ where content: label, size: f32::from(text_size), font, - color: style.text_color, + color: is_selected + .then(|| style.text_color) + .unwrap_or(style.placeholder_color), bounds: Rectangle { x: bounds.x + f32::from(padding.left), y: bounds.center_y(), |