Skip to main content

Visuals

Struct Visuals 

Source
pub struct Visuals {
Show 34 fields pub bg_color: Color, pub panel_fill: Color, pub top_bar_bg: Color, pub window_fill: Color, pub window_title_fill: Color, pub window_title_fill_drag: Color, pub window_shadow: Color, pub window_stroke: Color, pub window_title_text: Color, pub window_close_bg: Color, pub window_close_bg_hovered: Color, pub window_close_fg: Color, pub window_resize_hover: Color, pub window_resize_active: Color, pub text_color: Color, pub text_dim: Color, pub text_link: Color, pub text_link_hovered: Color, pub accent: Color, pub accent_hovered: Color, pub accent_pressed: Color, pub accent_focus: Color, pub widget_bg: Color, pub widget_bg_hovered: Color, pub widget_stroke: Color, pub widget_stroke_active: Color, pub track_bg: Color, pub scroll_track: Color, pub scroll_thumb: Color, pub scroll_thumb_hovered: Color, pub scroll_thumb_dragging: Color, pub separator: Color, pub selection_bg: Color, pub selection_bg_unfocused: Color,
}
Expand description

All colours used by the widget library.

The canonical way to access the active palette inside Widget::paint is:

let v = ctx.visuals();
ctx.set_fill_color(v.window_fill);

Fields§

§bg_color: Color

Canvas / app background (behind all floating windows).

§panel_fill: Color

Sidebar / panel background.

§top_bar_bg: Color

Top menu bar background.

§window_fill: Color

Window content-area background.

§window_title_fill: Color

Window title bar background (idle).

§window_title_fill_drag: Color

Window title bar background while dragging.

§window_shadow: Color

Drop-shadow colour (semi-transparent black/dark).

§window_stroke: Color

Thin border drawn around the window.

§window_title_text: Color

Title bar text colour.

§window_close_bg: Color

Close button background (idle).

§window_close_bg_hovered: Color

Close button background (hovered).

§window_close_fg: Color

Close button × glyph colour.

§window_resize_hover: Color

Resize edge / corner highlight colour when hovered (not yet dragging).

§window_resize_active: Color

Resize edge / corner highlight colour while actively dragging to resize.

§text_color: Color

Body text colour.

§text_dim: Color

Secondary / dimmed text (hints, labels).

§text_link: Color

Hyperlink colour (idle).

§text_link_hovered: Color

Hyperlink colour (hovered).

§accent: Color

Used for checked states, active tabs, slider fill, button backgrounds.

§accent_hovered: Color

Accent colour when hovered.

§accent_pressed: Color

Accent colour when pressed / active.

§accent_focus: Color

Low-opacity accent used for focus rings.

§widget_bg: Color

Widget background when unchecked / idle.

§widget_bg_hovered: Color

Widget background when hovered (unchecked).

§widget_stroke: Color

Widget border / outline (unchecked).

§widget_stroke_active: Color

Widget border / outline (checked / active).

§track_bg: Color§scroll_track: Color§scroll_thumb: Color§scroll_thumb_hovered: Color§scroll_thumb_dragging: Color§separator: Color§selection_bg: Color

Background colour behind selected text while the widget is focused.

§selection_bg_unfocused: Color

Background colour behind selected text while the widget is NOT focused. Uses a neutral grey to signal that the selection is inactive.

Implementations§

Source§

impl Visuals

Source

pub fn with_accent(self, accent: Color) -> Self

Return this palette with its primary accent replaced.

Source

pub fn with_accent_color(self, accent: AccentColor) -> Self

Return this palette with one of the built-in accent swatches applied.

Source

pub fn dark() -> Self

Dark-mode palette matching egui’s approximate dark colour scheme.

Source

pub fn light() -> Self

Light-mode palette matching egui’s approximate light colour scheme.

Source

pub fn for_preference(pref: ThemePreference) -> Self

Choose a palette from a ThemePreference. System falls back to dark.

Trait Implementations§

Source§

impl Clone for Visuals

Source§

fn clone(&self) -> Visuals

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 Visuals

Source§

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

Formats the value using the given formatter. Read more

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> 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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.