pub struct Palette { /* private fields */ }Expand description
Named colors, built from the validated PaletteDef for a game’s
ColorSet.
Implementations§
Source§impl Palette
impl Palette
Sourcepub fn new<C: ColorSet>(def: &PaletteDef) -> Result<Self, Vec<&'static str>>
pub fn new<C: ColorSet>(def: &PaletteDef) -> Result<Self, Vec<&'static str>>
Builds the palette for the colors of C. Fails with every one of
required_names the definition lacks (a palette checked against
them when it loaded never does).
Sourcepub fn get<C: ColorSet>(&self, color: C) -> Rgb
pub fn get<C: ColorSet>(&self, color: C) -> Rgb
The RGB value of a color of the set the palette was built for. A color of another set is looked up by its name (black if there is no such name).
Sourcepub fn engine(&self, color: EngineColor) -> Rgb
pub fn engine(&self, color: EngineColor) -> Rgb
The RGB value of an engine color.
Trait Implementations§
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