2022-11-10 01:10:28 +01:00
|
|
|
//! Change the appearance of an application.
|
2022-05-26 19:02:15 +02:00
|
|
|
use iced_core::Color;
|
|
|
|
|
|
2022-11-10 01:10:28 +01:00
|
|
|
/// A set of rules that dictate the style of an application.
|
2022-05-26 19:02:15 +02:00
|
|
|
pub trait StyleSheet {
|
2022-11-10 01:10:28 +01:00
|
|
|
/// The supported style of the [`StyleSheet`].
|
2022-11-09 04:05:31 +01:00
|
|
|
type Style: Default;
|
2022-05-26 19:02:15 +02:00
|
|
|
|
2022-11-10 01:10:28 +01:00
|
|
|
/// Returns the [`Appearance`] of the application for the provided [`Style`].
|
|
|
|
|
///
|
|
|
|
|
/// [`Style`]: Self::Style
|
2022-11-09 04:05:31 +01:00
|
|
|
fn appearance(&self, style: &Self::Style) -> Appearance;
|
2022-07-08 20:07:33 +02:00
|
|
|
}
|
|
|
|
|
|
2022-11-10 01:10:28 +01:00
|
|
|
/// The appearance of an application.
|
2022-07-08 20:07:33 +02:00
|
|
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
|
|
|
|
pub struct Appearance {
|
2022-11-10 01:10:28 +01:00
|
|
|
/// The background [`Color`] of the application.
|
2022-07-08 20:07:33 +02:00
|
|
|
pub background_color: Color,
|
2022-11-10 01:10:28 +01:00
|
|
|
|
|
|
|
|
/// The default text [`Color`] of the application.
|
2022-07-08 20:07:33 +02:00
|
|
|
pub text_color: Color,
|
2022-05-26 19:02:15 +02:00
|
|
|
}
|