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 color
Blurred button color
error_indicator: ColorSpec
Error indicator color
Implementations§
Source§impl Theme
impl Theme
pub fn real_cursor_color(&self, other: Option<&ColorSpec>) -> ColorSpec
Sourcepub fn catppuccin() -> Self
pub fn catppuccin() -> Self
Create a new theme with the catppuccin color scheme
Sourcepub fn color_rgb(r: u8, g: u8, b: u8) -> ColorSpec
pub fn color_rgb(r: u8, g: u8, b: u8) -> ColorSpec
Create a new color with foreground color from an RGB value.
Sourcepub fn color_ansi256(n: u8) -> ColorSpec
pub fn color_ansi256(n: u8) -> ColorSpec
Create a new color with foreground color from an ANSI 256 color code.
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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