WIP
This commit is contained in:
parent
5ce50b76f5
commit
a99552a105
24 changed files with 3717 additions and 100 deletions
|
@ -8,6 +8,15 @@ pub trait ColorCircle {
|
|||
#[must_use]
|
||||
fn previous(&self) -> Self;
|
||||
|
||||
#[must_use]
|
||||
fn middle(&self) -> Self;
|
||||
|
||||
#[must_use]
|
||||
fn start(&self) -> Self;
|
||||
|
||||
#[must_use]
|
||||
fn end(&self) -> Self;
|
||||
|
||||
#[must_use]
|
||||
fn next(&self) -> Self;
|
||||
}
|
||||
|
@ -25,6 +34,8 @@ impl UIColor for RGBColor {
|
|||
}
|
||||
}
|
||||
|
||||
pub trait UIColorCircle: UIColor + ColorCircle + Sized {}
|
||||
|
||||
macro_rules! color_map {
|
||||
($name:ident, $id:literal) => {
|
||||
#[derive(Debug, Clone)]
|
||||
|
@ -77,6 +88,18 @@ macro_rules! color_map {
|
|||
}
|
||||
}
|
||||
|
||||
fn middle(&self) -> Self {
|
||||
Self::_500
|
||||
}
|
||||
|
||||
fn start(&self) -> Self {
|
||||
Self::_50
|
||||
}
|
||||
|
||||
fn end(&self) -> Self {
|
||||
Self::_950
|
||||
}
|
||||
|
||||
fn previous(&self) -> Self {
|
||||
match self {
|
||||
$name::_50 => $name::_950,
|
||||
|
@ -133,6 +156,44 @@ pub enum Colors {
|
|||
White,
|
||||
}
|
||||
|
||||
impl ColorCircle for Colors {
|
||||
fn previous(&self) -> Self {
|
||||
match self {
|
||||
Colors::Black => Colors::White,
|
||||
Colors::White => Colors::Black,
|
||||
_ => self.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
fn middle(&self) -> Self {
|
||||
self.clone()
|
||||
}
|
||||
|
||||
fn start(&self) -> Self {
|
||||
match self {
|
||||
Colors::Black => Colors::White,
|
||||
Colors::White => Colors::White,
|
||||
_ => self.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
fn end(&self) -> Self {
|
||||
match self {
|
||||
Colors::Black => Colors::Black,
|
||||
Colors::White => Colors::Black,
|
||||
_ => self.clone(),
|
||||
}
|
||||
}
|
||||
|
||||
fn next(&self) -> Self {
|
||||
match self {
|
||||
Colors::Black => Colors::White,
|
||||
Colors::White => Colors::Black,
|
||||
_ => self.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl UIColor for Colors {
|
||||
fn color_class(&self) -> &str {
|
||||
match self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue