Colors

Struct Colors 

Source
pub struct Colors<C> {
Show 13 fields pub is_dark: bool, pub background: C, pub frame: C, pub edit_bg: C, pub edit_bg_disabled: C, pub edit_bg_error: C, pub accent: C, pub accent_soft: C, pub nav_focus: C, pub text: C, pub text_invert: C, pub text_disabled: C, pub text_sel_bg: C,
}
Expand description

Provides standard theme colours

Fields§

§is_dark: bool

True if this is a dark theme

§background: C

Background colour

§frame: C

Colour for frames (not always used)

§edit_bg: C

Background colour of EditBox

§edit_bg_disabled: C

Background colour of EditBox (disabled state)

§edit_bg_error: C

Background colour of EditBox (error state)

§accent: C

Theme accent

This should be a bold colour, used for small details.

§accent_soft: C

Soft version of accent

A softer version of the accent colour, used for block elements in some themes.

§nav_focus: C

Highlight colour for keyboard navigation

This may be the same as accent. It should contrast well with accent_soft. Themes should use nav_focus over accent where a strong contrast is required.

§text: C

Normal text colour (over background)

§text_invert: C

Opposing text colour (e.g. white if text is black)

§text_disabled: C

Disabled text colour

§text_sel_bg: C

Selected text background colour

This may be the same as accent_soft.

Implementations§

Source§

impl Colors<Rgba8Srgb>

Source

pub fn light() -> Self

Default “light” scheme

Source

pub fn dark() -> Self

Dark scheme

Source

pub fn blue() -> Self

Blue scheme

Source§

impl Colors<Rgba>

Source

pub fn adjust_for_state(col: Rgba, state: InputState) -> Rgba

Adjust a colour depending on state

Source

pub fn from_bg( &self, bg: Background, state: InputState, force_accent: bool, ) -> Rgba

Extract from Background

Source

pub fn from_edit_bg(&self, bg: Background, state: InputState) -> Rgba

Get colour of a text area, depending on state

Source

pub fn nav_region(&self, state: InputState) -> Option<Rgba>

Get colour for navigation highlight region, if any

Source

pub fn accent_state(&self, state: InputState) -> Rgba

Get accent colour, adjusted for state

Source

pub fn accent_soft_state(&self, state: InputState) -> Rgba

Get soft accent colour, adjusted for state

Source

pub fn check_mark_state(&self, state: InputState) -> Rgba

Get colour for a check box mark, depending on state

Source

pub fn menu_entry(&self, state: InputState) -> Option<Rgba>

Get background highlight colour of a menu entry, if any

Source

pub fn text_over(&self, bg: Rgba) -> Rgba

Get appropriate text colour over the given background

Trait Implementations§

Source§

impl<C: Clone> Clone for Colors<C>

Source§

fn clone(&self) -> Colors<C>

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<C: Debug> Debug for Colors<C>

Source§

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

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

impl<'de, C> Deserialize<'de> for Colors<C>
where C: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<Colors<Rgba>> for ColorsSrgb

Source§

fn from(col: ColorsLinear) -> Self

Converts to this type from the input type.
Source§

impl From<Colors<Rgba8Srgb>> for ColorsLinear

Source§

fn from(col: ColorsSrgb) -> Self

Converts to this type from the input type.
Source§

impl<C: PartialEq> PartialEq for Colors<C>

Source§

fn eq(&self, other: &Colors<C>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<C> Serialize for Colors<C>
where C: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<C> StructuralPartialEq for Colors<C>

Auto Trait Implementations§

§

impl<C> Freeze for Colors<C>
where C: Freeze,

§

impl<C> RefUnwindSafe for Colors<C>
where C: RefUnwindSafe,

§

impl<C> Send for Colors<C>
where C: Send,

§

impl<C> Sync for Colors<C>
where C: Sync,

§

impl<C> Unpin for Colors<C>
where C: Unpin,

§

impl<C> UnwindSafe for Colors<C>
where C: UnwindSafe,

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<S, T> Cast<T> for S
where T: Conv<S>,

Source§

fn cast(self) -> T

Cast from Self to T Read more
Source§

fn try_cast(self) -> Result<T, Error>

Try converting from Self to T Read more
Source§

impl<S, T> CastApprox<T> for S
where T: ConvApprox<S>,

Source§

fn try_cast_approx(self) -> Result<T, Error>

Try approximate conversion from Self to T Read more
Source§

fn cast_approx(self) -> T

Cast approximately from Self to T Read more
Source§

impl<S, T> CastFloat<T> for S
where T: ConvFloat<S>,

Source§

fn cast_trunc(self) -> T

Cast to integer, truncating Read more
Source§

fn cast_nearest(self) -> T

Cast to the nearest integer Read more
Source§

fn cast_floor(self) -> T

Cast the floor to an integer Read more
Source§

fn cast_ceil(self) -> T

Cast the ceiling to an integer Read more
Source§

fn try_cast_trunc(self) -> Result<T, Error>

Try converting to integer with truncation Read more
Source§

fn try_cast_nearest(self) -> Result<T, Error>

Try converting to the nearest integer Read more
Source§

fn try_cast_floor(self) -> Result<T, Error>

Try converting the floor to an integer Read more
Source§

fn try_cast_ceil(self) -> Result<T, Error>

Try convert the ceiling to an integer 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,