Struct color_brewery::Palette

source ·
pub struct Palette<Color> { /* private fields */ }

Implementations§

source§

impl<Color> Palette<Color>where Color: RGBColor,

Color palettes (aka colormaps)

A Colormap with certain characteristics.

source

pub fn len(&self) -> usize

Returns the number of colors in the palette.

Palettes countains at least 2 colors.

source

pub fn typ(&self) -> PaletteType

Says whether the palette is Sequential, Divergent or Qualitative.

source

pub fn blind(&self) -> Trivalent

Says whether the palette is colorblind safe (if the palette specifies it).

source

pub fn print(&self) -> Trivalent

Says whether the palette is suitable for desktop color printing.

source

pub fn photocopy(&self) -> Trivalent

Says whether the palette will withstand black and white photocopying.

source

pub fn lcd(&self) -> Trivalent

Says whether the palette is friendly for LCD screens (which tend to wash-out colors).

source

pub fn colors(&self) -> Vec<Color>

Returns the RGB colors of the palette.

source

pub fn gradient(&self) -> PaletteGradient<Color>

Returns a gradient constructed from the palette. It only makes sense for sequential and some diverging palettes.

Examples found in repository?
examples/gradient.rs (line 54)
52
53
54
55
56
fn palette(fh: &mut impl Write, palette: Palette<RGB8>, n: usize,
           width: u32, comment: &str) -> Result<(), Err> {
    let g = palette.gradient();
    range(fh, |t| g.rgb(t), n, width, comment)
}

Trait Implementations§

source§

impl<Color: Clone> Clone for Palette<Color>

source§

fn clone(&self) -> Palette<Color>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<Color: Copy> Copy for Palette<Color>

Auto Trait Implementations§

§

impl<Color> RefUnwindSafe for Palette<Color>where Color: RefUnwindSafe,

§

impl<Color> Send for Palette<Color>where Color: Send,

§

impl<Color> Sync for Palette<Color>where Color: Sync,

§

impl<Color> Unpin for Palette<Color>where Color: Unpin,

§

impl<Color> UnwindSafe for Palette<Color>where Color: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.