Struct cursive::theme::Palette [−][src]
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]
impl Palette
pub fn custom<'a>(&'a self, key: &str) -> Option<&'a Color>
[src]
pub fn custom<'a>(&'a self, key: &str) -> Option<&'a Color>
Returns a custom color from this palette.
Returns None
if the given key was not found.
pub fn merge(&self, namespace: &str) -> Palette
[src]
pub fn merge(&self, namespace: &str) -> Palette
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]
pub fn set_color(&mut self, key: &str, color: Color)
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]
pub fn add_namespace(
&mut self,
key: &str,
namespace: HashMap<String, PaletteNode>
)
Adds a color namespace to this palette.
Trait Implementations
impl PartialEq for Palette
[src]
impl PartialEq for Palette
fn eq(&self, other: &Palette) -> bool
[src]
fn eq(&self, other: &Palette) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Palette) -> bool
[src]
fn ne(&self, other: &Palette) -> bool
This method tests for !=
.
impl Eq for Palette
[src]
impl Eq for Palette
impl Clone for Palette
[src]
impl Clone for Palette
fn clone(&self) -> Palette
[src]
fn clone(&self) -> Palette
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for Palette
[src]
impl Debug for Palette
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Index<PaletteColor> for Palette
[src]
impl Index<PaletteColor> for Palette
type Output = Color
The returned type after indexing.
fn index(&self, palette_color: PaletteColor) -> &Color
[src]
fn index(&self, palette_color: PaletteColor) -> &Color
Performs the indexing (container[index]
) operation.
impl IndexMut<PaletteColor> for Palette
[src]
impl IndexMut<PaletteColor> for Palette
fn index_mut(&mut self, palette_color: PaletteColor) -> &mut Color
[src]
fn index_mut(&mut self, palette_color: PaletteColor) -> &mut Color
Performs the mutable indexing (container[index]
) operation.
impl Default for Palette
[src]
impl Default for Palette
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)