2022-11-10 01:10:28 +01:00
|
|
|
//! Change the appearance of text.
|
2023-03-04 05:37:11 +01:00
|
|
|
use crate::core::Color;
|
2022-06-29 10:51:01 +02:00
|
|
|
|
2022-11-10 01:10:28 +01:00
|
|
|
/// The style sheet of some text.
|
2022-06-29 10:51:01 +02:00
|
|
|
pub trait StyleSheet {
|
2022-11-10 01:10:28 +01:00
|
|
|
/// The supported style of the [`StyleSheet`].
|
2022-06-29 10:51:01 +02:00
|
|
|
type Style: Default + Copy;
|
|
|
|
|
|
2022-11-10 01:10:28 +01:00
|
|
|
/// Produces the [`Appearance`] of some text.
|
2022-06-29 10:51:01 +02:00
|
|
|
fn appearance(&self, style: Self::Style) -> Appearance;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-10 01:10:28 +01:00
|
|
|
/// The apperance of some text.
|
2022-07-09 18:03:59 +02:00
|
|
|
#[derive(Debug, Clone, Copy, Default)]
|
2022-06-29 10:51:01 +02:00
|
|
|
pub struct Appearance {
|
2022-11-10 01:10:28 +01:00
|
|
|
/// The [`Color`] of the text.
|
|
|
|
|
///
|
|
|
|
|
/// The default, `None`, means using the inherited color.
|
2022-06-29 10:51:01 +02:00
|
|
|
pub color: Option<Color>,
|
|
|
|
|
}
|