[][src]Struct cursive::theme::Palette

pub struct Palette { /* fields omitted */ }

Color configuration for the application.

Assign each color role an actual color.

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

Example

use cursive::theme::PaletteColor::*;
use cursive::theme::Color::*;
use cursive::theme::BaseColor::*;

let mut palette = Palette::default();

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

Methods

impl Palette[src]

pub fn custom<'a>(&'a self, key: &str) -> Option<&'a Color>[src]

Returns a custom color from this palette.

Returns None if the given key was not found.

pub fn merge(&self, namespace: &str) -> Palette[src]

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

All values in the namespace will override previous values.

pub fn set_color(&mut self, key: &str, color: Color)[src]

Sets the color for the given key.

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

pub fn add_namespace(
    &mut self,
    key: &str,
    namespace: HashMap<String, PaletteNode, ABuildHasher>
)
[src]

Adds a color namespace to this palette.

Trait Implementations

impl Clone for Palette[src]

impl Debug for Palette[src]

impl Default for Palette[src]

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)

impl Eq for Palette[src]

impl Index<PaletteColor> for Palette[src]

type Output = Color

The returned type after indexing.

impl IndexMut<PaletteColor> for Palette[src]

impl PartialEq<Palette> for Palette[src]

impl StructuralEq for Palette[src]

impl StructuralPartialEq for Palette[src]

Auto Trait Implementations

impl RefUnwindSafe for Palette

impl Send for Palette

impl Sync for Palette

impl Unpin for Palette

impl UnwindSafe for Palette

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Erased for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.