Struct Theme

Source
pub struct Theme {
Show 22 fields pub title: ColorSpec, pub description: ColorSpec, pub cursor: ColorSpec, pub cursor_str: String, pub selected_option: ColorSpec, pub selected_prefix: String, pub selected_prefix_fg: ColorSpec, pub unselected_option: ColorSpec, pub unselected_prefix: String, pub unselected_prefix_fg: ColorSpec, pub cursor_shape: CursorShape, pub cursor_style: ColorSpec, pub force_style: bool, pub input_cursor: ColorSpec, pub input_placeholder: ColorSpec, pub input_prompt: ColorSpec, pub help_key: ColorSpec, pub help_desc: ColorSpec, pub help_sep: ColorSpec, pub focused_button: ColorSpec, pub blurred_button: ColorSpec, pub error_indicator: ColorSpec,
}
Expand description

Theme for styling the UI.

§Example

use demand::Theme;

let custom_theme = Theme {
  selected_prefix: String::from(" •"),
  unselected_prefix: String::from("  "),
..Theme::default()
};

Fields§

§title: ColorSpec

Prompt title color

§description: ColorSpec

Prompt description color

§cursor: ColorSpec

Cursor color

§cursor_str: String

Cursor string e.g. “❯ “

§selected_option: ColorSpec

Selected option color

§selected_prefix: String

Selected option prefix color

§selected_prefix_fg: ColorSpec

Selected prefix foreground color

§unselected_option: ColorSpec

Unselected option color

§unselected_prefix: String

Unselected option prefix color

§unselected_prefix_fg: ColorSpec

Unselected prefix foreground color

§cursor_shape: CursorShape

Char to use for the cursor

§cursor_style: ColorSpec

the color when there isn’t text to get color from

§force_style: bool

use cursor_style even when there is text to get color from

§input_cursor: ColorSpec

Input cursor color

§input_placeholder: ColorSpec

Input placeholder color

§input_prompt: ColorSpec

Input prompt color

§help_key: ColorSpec

Help item key color

§help_desc: ColorSpec

Help item description color

§help_sep: ColorSpec

Help item separator color

§focused_button: ColorSpec

Focused button color

§blurred_button: ColorSpec

Blurred button color

§error_indicator: ColorSpec

Error indicator color

Implementations§

Source§

impl Theme

Source

pub fn new() -> Self

Create a new theme with no colors.

Source

pub fn real_cursor_color(&self, other: Option<&ColorSpec>) -> ColorSpec

Source

pub fn charm() -> Self

Create a new theme with the charm color scheme

Source

pub fn dracula() -> Self

Create a new theme with the dracula color scheme

Source

pub fn base16() -> Self

Create a new theme with the base16 color scheme

Source

pub fn catppuccin() -> Self

Create a new theme with the catppuccin color scheme

Source

pub fn color_rgb(r: u8, g: u8, b: u8) -> ColorSpec

Create a new color with foreground color from an RGB value.

Source

pub fn color_ansi256(n: u8) -> ColorSpec

Create a new color with foreground color from an ANSI 256 color code.

Trait Implementations§

Source§

impl Clone for Theme

Source§

fn clone(&self) -> Theme

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Theme

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Theme

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Freeze for Theme

§

impl RefUnwindSafe for Theme

§

impl Send for Theme

§

impl Sync for Theme

§

impl Unpin for Theme

§

impl UnwindSafe for Theme

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.