pub struct ColorStyle {
    pub front: ColorType,
    pub back: ColorType,
}
Expand description

Possible color style for a cell.

Represents a color pair role to use when printing something.

The current theme will assign each role a foreground and background color.

The Default value is to inherit the parent’s colors.

Fields§

§front: ColorType

Color used for the foreground (the text itself).

§back: ColorType

Color used for the background.

Implementations§

Creates a new color style, using the given values for front and back.

Examples
use cursive::theme::ColorStyle;

// `BaseColor` implements `Into<ColorStyle>`
use cursive::theme::BaseColor::*;
let red_on_black = ColorStyle::new(Red, Black);

// So does `Color`.
let red_on_black = ColorStyle::new(Red.light(), Black.dark());

// Or `PaletteColor`.
use cursive::theme::PaletteColor::*;
let primary = ColorStyle::new(Primary, View);

Uses the given color as front, inherits the parent background color.

Examples
use cursive::theme::{BaseColor::*, ColorStyle, ColorType};

let color = ColorStyle::front(Red.dark());

assert_eq!(color, ColorStyle::new(Red.dark(), ColorType::InheritParent));

Uses the given color as background, inherits the parent front color.

Examples
use cursive::theme::{BaseColor::*, ColorStyle, ColorType};

let color = ColorStyle::back(Black.dark());

assert_eq!(
    color,
    ColorStyle::new(ColorType::InheritParent, Black.dark())
);

Returns an inverted color style, with the front and back colors swapped.

Examples
use cursive::theme::BaseColor::*;
use cursive::theme::ColorStyle;

let red_on_black = ColorStyle::new(Red.dark(), Black.dark());
let black_on_red = red_on_black.invert();

assert_eq!(black_on_red, ColorStyle::new(Black.dark(), Red.dark()));

Uses ColorType::InheritParent for both front and background.

Style set by terminal before entering a Cursive program.

Application background, where no view is present.

Color used by view shadows. Only background matters.

Main text with default background.

Secondary text color, with default background.

Tertiary text color, with default background.

Title text color with default background.

Alternative color for a title.

Alternate text with highlight background.

Highlight color for inactive views (not in focus).

Merge the color type new over the color type old.

This merges the front and back color types of a and b.

Return the color pair that this style represents.

Apply a function to both the front and back colors.

Apply a function to each pair of front/back color.

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 value” for a type. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. 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.