2019-10-08 03:13:41 +02:00
|
|
|
use crate::Color;
|
|
|
|
|
|
2019-11-18 07:16:19 +01:00
|
|
|
/// The background of some element.
|
2019-10-08 03:13:41 +02:00
|
|
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
|
|
|
|
pub enum Background {
|
2019-11-18 07:16:19 +01:00
|
|
|
/// A solid color
|
2019-10-08 03:13:41 +02:00
|
|
|
Color(Color),
|
|
|
|
|
// TODO: Add gradient and image variants
|
|
|
|
|
}
|
2019-12-04 22:02:07 +01:00
|
|
|
|
|
|
|
|
impl From<Color> for Background {
|
|
|
|
|
fn from(color: Color) -> Self {
|
|
|
|
|
Background::Color(color)
|
|
|
|
|
}
|
2020-01-01 17:27:14 +01:00
|
|
|
}
|
2020-08-19 01:30:22 +02:00
|
|
|
|
|
|
|
|
impl From<Color> for Option<Background> {
|
|
|
|
|
fn from(color: Color) -> Self {
|
|
|
|
|
Some(Background::from(color))
|
|
|
|
|
}
|
2020-08-19 01:30:46 +02:00
|
|
|
}
|