You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1009 B
36 lines
1009 B
#[derive(Clone, PartialEq)] |
|
pub enum Color { |
|
Primary, |
|
Secondary, |
|
Success, |
|
Danger, |
|
Warning, |
|
Info, |
|
Light, |
|
Dark, |
|
White, |
|
Unset, |
|
} |
|
|
|
impl Default for Color { |
|
fn default() -> Self { |
|
Self::Unset |
|
} |
|
} |
|
|
|
impl Color { |
|
pub fn with_prefix<S: AsRef<str>>(&self, prefix: S) -> String { |
|
match self { |
|
Self::Primary => format!("{}-primary", prefix.as_ref()), |
|
Self::Secondary => format!("{}-secondary", prefix.as_ref()), |
|
Self::Success => format!("{}-success", prefix.as_ref()), |
|
Self::Danger => format!("{}-danger", prefix.as_ref()), |
|
Self::Warning => format!("{}-warning", prefix.as_ref()), |
|
Self::Info => format!("{}-info", prefix.as_ref()), |
|
Self::Light => format!("{}-light", prefix.as_ref()), |
|
Self::Dark => format!("{}-dark", prefix.as_ref()), |
|
Self::White => format!("{}-white", prefix.as_ref()), |
|
Self::Unset => "".into(), |
|
} |
|
} |
|
}
|
|
|