Skip to main content

WorkbenchStyle

Struct WorkbenchStyle 

Source
pub struct WorkbenchStyle {
    pub density: Density,
    pub control_radius: u8,
    pub item_radius: u8,
    pub inner_radius: u8,
    pub container_radius: u8,
    pub dialog_radius: u8,
    pub pill_radius: u8,
    pub border_width: f32,
    pub text_scale: f32,
}
Expand description

Shape and density shared by every component.

Fields§

§density: Density

Control and row heights.

§control_radius: u8

Buttons, text fields, selects, steppers, context menus, and egui widgets.

§item_radius: u8

Hover fills of icon buttons, nav items, and segmented controls.

§inner_radius: u8

Small shapes inside other shapes: menu and tree rows, checkboxes, segments, toolbar buttons. Tiny hover targets use one point less (Self::tight).

§container_radius: u8

Cards, popovers, legends, and egui windows.

§dialog_radius: u8

Modal dialogs and toasts.

§pill_radius: u8

Capsules: badges, switches, and the title-bar search. Clamped to half the shape’s height, so the default draws full capsules at any height.

§border_width: f32

Borders of controls, cards, popovers, and dialogs (0.0 removes them). Separators and focus rings keep their own widths.

§text_scale: f32

Multiplies every font size (body, buttons, menus, chrome). Clamped to 0.75..=1.5; heights follow the density, not the text.

Implementations§

Source§

impl WorkbenchStyle

Source

pub fn sharp() -> WorkbenchStyle

Square corners everywhere, for a flat or “technical” look.

Source

pub fn rounded() -> WorkbenchStyle

Larger radii for a softer look.

Source

pub fn with_density(self, density: Density) -> WorkbenchStyle

The same style with another density.

Source

pub fn scaled(&self, height: f32) -> f32

A reference height scaled by the density, on whole points.

Source

pub fn control_height(&self) -> f32

Height of text fields, selects, steppers, and dialog buttons.

Source

pub fn size_height(&self, size: Size) -> f32

Height of a builder button of size.

Source

pub fn size_padding(&self, size: Size) -> Vec2

Button padding of size, vertical part scaled by the density.

Source

pub fn menu_row_height(&self) -> f32

Height of a context-menu row.

Source

pub fn list_row_height(&self) -> f32

Height of a palette or keyboard-menu row.

Source

pub fn tree_row_height(&self) -> f32

Height of an explorer tree row.

Source

pub fn control(&self) -> CornerRadius

Corner radius of controls.

Source

pub fn item(&self) -> CornerRadius

Corner radius of row and icon hover fills.

Source

pub fn container(&self) -> CornerRadius

Corner radius of cards, popovers, and menus.

Source

pub fn dialog(&self) -> CornerRadius

Corner radius of dialogs and toasts.

Source

pub fn inner(&self) -> CornerRadius

Corner radius of shapes nested in other shapes (menu rows, checkboxes).

Source

pub fn tight(&self) -> CornerRadius

One point under Self::inner: tiny hover targets such as a tab’s close button or a stepper arrow.

Source

pub fn mark(&self) -> CornerRadius

Indicator bars and underlines (1 pt, square in a sharp style).

Source

pub fn pill(&self, height: f32) -> CornerRadius

Corner radius of a capsule height points tall.

Source

pub fn border(&self, color: Color32) -> Stroke

A border of the style’s width.

Source

pub fn text_scale(&self) -> f32

The effective text scale.

Source

pub fn font_size(&self, points: f32) -> f32

A reference font size (in points) scaled by Self::text_scale.

Source

pub fn font(&self, points: f32) -> FontId

The proportional font of a reference size.

Source

pub fn mono(&self, points: f32) -> FontId

The monospace font of a reference size.

Source

pub fn text(&self, size: Size) -> f32

The label size of a builder Size.

Trait Implementations§

Source§

impl Clone for WorkbenchStyle

Source§

fn clone(&self) -> WorkbenchStyle

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for WorkbenchStyle

Source§

impl Debug for WorkbenchStyle

Source§

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

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

impl Default for WorkbenchStyle

Source§

fn default() -> WorkbenchStyle

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

impl PartialEq for WorkbenchStyle

Source§

fn eq(&self, other: &WorkbenchStyle) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for WorkbenchStyle

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,