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§
fn surface(self, theme: &Theme, surface: Surface) -> Self
fn text_tone(self, theme: &Theme, tone: TextTone) -> Self
Sourcefn type_scale(self, theme: &Theme, scale: TypeScale) -> Self
fn type_scale(self, theme: &Theme, scale: TypeScale) -> Self
Applies size, line height and weight from one typographic step.
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
Sourcefn elevation(self, theme: &Theme, level: Elevation) -> Self
fn elevation(self, theme: &Theme, level: Elevation) -> Self
Applies the shadow for an elevation step. Flat applies nothing.
fn hairline(self, theme: &Theme) -> Self
fn hairline_strong(self, theme: &Theme) -> Self
Sourcefn frame(self, theme: &Theme, surface: Surface, level: Elevation) -> Self
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.
Sourcefn well(self, theme: &Theme) -> Self
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.
Sourcefn glow(self, theme: &Theme, color: Hsla) -> Self
fn glow(self, theme: &Theme, color: Hsla) -> Self
The colour a surface in a named state bleeds into the pixels around it.
fn column(self) -> Self
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".