Skip to main content

FocusStyle

Struct FocusStyle 

Source
pub struct FocusStyle {
    pub border_chars: Option<BorderChars>,
    pub border_color: Option<Color>,
    pub text_color: Option<Color>,
    pub bg_color: Option<Color>,
}
Expand description

Styling configuration for widget focus states.

FocusStyle provides a builder pattern for configuring visual feedback when widgets are focused. It supports custom border styles, colors, and text highlighting to make focused widgets visually distinct.

§Examples

use minui::widgets::FocusStyle;
use minui::{BorderChars, Color};

// Default focus style
let default = FocusStyle::new();

// Custom focus style with blue double-line border
let custom = FocusStyle::new()
    .with_border_chars(BorderChars::double_line())
    .with_border_color(Color::Blue);

// Focus style with text highlighting
let highlighted = FocusStyle::new()
    .with_text_color(Color::Cyan);

Fields§

§border_chars: Option<BorderChars>

Border characters for focused state (None = no border change)

§border_color: Option<Color>

Border color for focused state

§text_color: Option<Color>

Text color for focused state

§bg_color: Option<Color>

Background color for focused state

Implementations§

Source§

impl FocusStyle

Source

pub fn new() -> Self

Creates a new focus style with defaults.

Defaults: None for all style fields (no visual change when focused).

Source

pub fn with_border_chars(self, chars: BorderChars) -> Self

Sets the border characters for the focused state.

Source

pub fn with_border_color(self, color: Color) -> Self

Sets the border color for the focused state.

Source

pub fn with_text_color(self, color: Color) -> Self

Sets the text color for the focused state.

Source

pub fn with_bg_color(self, color: Color) -> Self

Sets the background color for the focused state.

Source

pub fn focused() -> Self

Creates a standard “focused” style with blue double-line border.

Source

pub fn highlighted() -> Self

Creates a standard “highlighted” style (no border, just colors).

Trait Implementations§

Source§

impl Clone for FocusStyle

Source§

fn clone(&self) -> FocusStyle

Returns a duplicate 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 FocusStyle

Source§

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

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

impl Default for FocusStyle

Source§

fn default() -> Self

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

impl Copy for FocusStyle

Auto Trait Implementations§

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> 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.