[−][src]Struct cursive::theme::Palette
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>
)
[src]
&mut self,
key: &str,
namespace: HashMap<String, PaletteNode>
)
Adds a color namespace to this palette.
Trait Implementations
impl Clone for Palette
[src]
fn clone(&self) -> Palette
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
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
=>Dark(White)
TitlePrimary
=>Dark(Red)
TitleSecondary
=>Dark(Yellow)
Highlight
=>Dark(Red)
HighlightInactive
=>Dark(Blue)
impl PartialEq<Palette> for Palette
[src]
impl Eq for Palette
[src]
impl Debug for Palette
[src]
impl Index<PaletteColor> for Palette
[src]
type Output = Color
The returned type after indexing.
fn index(&self, palette_color: PaletteColor) -> &Color
[src]
impl IndexMut<PaletteColor> for Palette
[src]
fn index_mut(&mut self, palette_color: PaletteColor) -> &mut Color
[src]
Auto Trait Implementations
impl Unpin for Palette
impl Sync for Palette
impl Send for Palette
impl UnwindSafe for Palette
impl RefUnwindSafe for Palette
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,