Skip to main content

StyledExt

Trait StyledExt 

Source
pub trait StyledExt: Styled + Sized {
Show 17 methods // Provided methods fn surface(self, theme: &Theme, surface: Surface) -> Self { ... } fn text_tone(self, theme: &Theme, tone: TextTone) -> Self { ... } fn type_scale(self, theme: &Theme, scale: TypeScale) -> Self { ... } fn radius(self, theme: &Theme, radius: Radius) -> Self { ... } fn gap_token(self, theme: &Theme, space: Space) -> Self { ... } fn p_token(self, theme: &Theme, space: Space) -> Self { ... } fn px_token(self, theme: &Theme, space: Space) -> Self { ... } fn py_token(self, theme: &Theme, space: Space) -> Self { ... } fn mt_token(self, theme: &Theme, space: Space) -> Self { ... } fn elevation(self, theme: &Theme, level: Elevation) -> Self { ... } fn hairline(self, theme: &Theme) -> Self { ... } fn hairline_strong(self, theme: &Theme) -> Self { ... } fn frame(self, theme: &Theme, surface: Surface, level: Elevation) -> Self { ... } fn well(self, theme: &Theme) -> Self { ... } fn glow(self, theme: &Theme, color: Hsla) -> Self { ... } fn row(self) -> Self { ... } fn column(self) -> Self { ... }
}
Expand description

Token-addressed styling helpers.

These exist so component code names a semantic role instead of repeating a literal, which keeps crates/gpui-kit-tokens/tokens/*.json the single authority for values that occur more than once.

Provided Methods§

Source

fn surface(self, theme: &Theme, surface: Surface) -> Self

Source

fn text_tone(self, theme: &Theme, tone: TextTone) -> Self

Source

fn type_scale(self, theme: &Theme, scale: TypeScale) -> Self

Applies size, line height and weight from one typographic step.

Source

fn radius(self, theme: &Theme, radius: Radius) -> Self

Source

fn gap_token(self, theme: &Theme, space: Space) -> Self

Source

fn p_token(self, theme: &Theme, space: Space) -> Self

Source

fn px_token(self, theme: &Theme, space: Space) -> Self

Source

fn py_token(self, theme: &Theme, space: Space) -> Self

Source

fn mt_token(self, theme: &Theme, space: Space) -> Self

Source

fn elevation(self, theme: &Theme, level: Elevation) -> Self

Applies the shadow for an elevation step. Flat applies nothing.

Source

fn hairline(self, theme: &Theme) -> Self

Source

fn hairline_strong(self, theme: &Theme) -> Self

Source

fn frame(self, theme: &Theme, surface: Surface, level: Elevation) -> Self

A surface that is a distinct thing from the one behind it.

The colour step and the shadow do the separating, which is why a card, a popover and a dialog carry no line around them: a line drawn around something already legible is decoration, and this library reserves lines for what they alone can say — focus, invalidity, a drop target.

Source

fn well(self, theme: &Theme) -> Self

The recess an editable value sits in.

A field is a well rather than an outlined box, so the resting state of every editable control in the library is a colour and nothing else. The border it still carries is transparent and exists only to hold the space that an invalid state will colour, so becoming invalid never reflows the row the field is in.

Source

fn glow(self, theme: &Theme, color: Hsla) -> Self

The colour a surface in a named state bleeds into the pixels around it.

Source

fn row(self) -> Self

A horizontal flex row, the layout most component frames start from.

Source

fn column(self) -> Self

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: Styled + Sized> StyledExt for T