Added support for gradients as background variants + other optimizations.
This commit is contained in:
parent
669f7cc74b
commit
6551a0b2ab
41 changed files with 1658 additions and 1489 deletions
|
|
@ -1,11 +1,13 @@
|
|||
use crate::Color;
|
||||
use crate::{Color, Gradient};
|
||||
|
||||
/// The background of some element.
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub enum Background {
|
||||
/// A solid color
|
||||
/// A solid color.
|
||||
Color(Color),
|
||||
// TODO: Add gradient and image variants
|
||||
/// Linearly interpolate between several colors.
|
||||
Gradient(Gradient),
|
||||
// TODO: Add image variant
|
||||
}
|
||||
|
||||
impl From<Color> for Background {
|
||||
|
|
@ -19,3 +21,9 @@ impl From<Color> for Option<Background> {
|
|||
Some(Background::from(color))
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Gradient> for Option<Background> {
|
||||
fn from(gradient: Gradient) -> Self {
|
||||
Some(Background::Gradient(gradient))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue