pub struct Palette { /* private fields */ }
Expand description

Color configuration for the application.

Assign each color role an actual color.

It implements Index and IndexMut to access and modify this mapping:

It also implements Extend to update a batch of colors at once.

Example

use cursive_core::theme::{BaseColor::*, Color::*, PaletteColor::*};

let mut palette = Palette::default();

assert_eq!(palette[Background], Dark(Blue));
palette[Shadow] = Light(Red);
assert_eq!(palette[Shadow], Light(Red));

let colors = vec![(Shadow, Dark(Green)), (Primary, Light(Blue))];
palette.extend(colors);
assert_eq!(palette[Shadow], Dark(Green));
assert_eq!(palette[Primary], Light(Blue));

Implementations

Returns a custom color from this palette.

Returns None if the given key was not found.

Returns a new palette where the given namespace has been merged.

All values in the namespace will override previous values.

Sets the color for the given key.

This will update either the basic palette or the custom values.

Sets a basic color from its name.

Returns Err(()) if key is not a known PaletteColor.

Adds a color namespace to this palette.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the default palette for a cursive application.

  • Background => Dark(Blue)
  • Shadow => Dark(Black)
  • View => Dark(White)
  • Primary => Dark(Black)
  • Secondary => Dark(Blue)
  • Tertiary => Light(White)
  • TitlePrimary => Dark(Red)
  • TitleSecondary => Dark(Yellow)
  • Highlight => Dark(Red)
  • HighlightInactive => Dark(Blue)
  • HighlightText => Dark(White)

Returns the “default value” for a type. Read more

Extends a collection with the contents of an iterator. Read more

🔬This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

🔬This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

Performs the mutable indexing (container[index]) operation. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self

The resulting type after obtaining ownership.

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

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Calls the given closure and return the result. Read more

Calls the given closure on self.

Calls the given closure on self.

Calls the given closure if condition == true.