iced-yoda/style/src/text_input.rs

34 lines
957 B
Rust
Raw Normal View History

2020-01-01 18:26:49 +01:00
//! Display fields that can be filled with text.
use iced_core::{Background, Color};
/// The appearance of a text input.
#[derive(Debug, Clone, Copy)]
pub struct Appearance {
2020-01-01 18:26:49 +01:00
pub background: Background,
pub border_radius: f32,
pub border_width: f32,
2020-01-01 18:26:49 +01:00
pub border_color: Color,
}
/// A set of rules that dictate the style of a text input.
pub trait StyleSheet {
type Style: Default + Copy;
2020-01-01 18:26:49 +01:00
/// Produces the style of an active text input.
fn active(&self, style: Self::Style) -> Appearance;
2020-01-01 18:26:49 +01:00
/// Produces the style of a focused text input.
fn focused(&self, style: Self::Style) -> Appearance;
2020-01-01 18:26:49 +01:00
fn placeholder_color(&self, style: Self::Style) -> Color;
2020-01-06 18:44:45 +01:00
fn value_color(&self, style: Self::Style) -> Color;
2020-01-06 18:44:45 +01:00
fn selection_color(&self, style: Self::Style) -> Color;
2020-02-22 21:33:45 +01:00
2020-01-01 18:26:49 +01:00
/// Produces the style of an hovered text input.
fn hovered(&self, style: Self::Style) -> Appearance {
self.focused(style)
2020-01-01 18:26:49 +01:00
}
}