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: ColorSpecPrompt title color
description: ColorSpecPrompt description color
cursor: ColorSpecCursor color
cursor_str: StringCursor string e.g. “❯ “
selected_option: ColorSpecSelected option color
selected_prefix: StringSelected option prefix color
selected_prefix_fg: ColorSpecSelected prefix foreground color
unselected_option: ColorSpecUnselected option color
unselected_prefix: StringUnselected option prefix color
unselected_prefix_fg: ColorSpecUnselected prefix foreground color
cursor_shape: CursorShapeChar to use for the cursor
cursor_style: ColorSpecthe color when there isn’t text to get color from
force_style: booluse cursor_style even when there is text to get color from
input_cursor: ColorSpecInput cursor color
input_placeholder: ColorSpecInput placeholder color
input_prompt: ColorSpecInput prompt color
help_key: ColorSpecHelp item key color
help_desc: ColorSpecHelp item description color
help_sep: ColorSpecHelp item separator color
Focused button color
Blurred button color
error_indicator: ColorSpecError 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