pub struct Palette(/* private fields */);Expand description
Color palette with named hue ramps (TOML section [palette]).
Each ramp is a 0-indexed Vec<String> where values are either
#RRGGBB hex strings or ansi.<key> references.
Ramps should be ordered darkest (index 0) to lightest.
Implementations§
Source§impl Palette
impl Palette
Sourcepub fn new(map: HashMap<String, Vec<String>>) -> Self
pub fn new(map: HashMap<String, Vec<String>>) -> Self
Create a palette from a map of ramp names to color vectors.
Sourcepub fn get_ramp(&self, name: &str) -> Option<&[String]>
pub fn get_ramp(&self, name: &str) -> Option<&[String]>
Return the named ramp, or None if it doesn’t exist.
Sourcepub fn ramp_names(&self) -> Vec<&str>
pub fn ramp_names(&self) -> Vec<&str>
Return all ramp names in sorted order.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Palette
impl<'de> Deserialize<'de> for Palette
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Palette
impl StructuralPartialEq for Palette
Auto Trait Implementations§
impl Freeze for Palette
impl RefUnwindSafe for Palette
impl Send for Palette
impl Sync for Palette
impl Unpin for Palette
impl UnsafeUnpin for Palette
impl UnwindSafe for Palette
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more