use self::Theme::*;
use std::fmt;
#[non_exhaustive]
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
pub enum Theme {
#[default]
Light,
Dark,
Custom(&'static str),
}
impl Theme {
#[inline]
pub fn is_light(&self) -> bool {
self == &Light
}
#[inline]
pub fn is_dark(&self) -> bool {
self == &Dark
}
#[inline]
pub fn as_str(&self) -> &'static str {
match self {
Light => "light",
Dark => "dark",
Custom(name) => name,
}
}
}
impl fmt::Display for Theme {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.as_str().fmt(f)
}
}