pub trait ButtonExt: Sized {
// Required method
fn primary(self) -> Self;
}Expand description
The appearance variants of a button.
Import the trait to use them:
use smudge_widgets::ButtonExt;
use smudge_widgets::button;
let save = button("Save").primary();Required Methods§
Sourcefn primary(self) -> Self
fn primary(self) -> Self
Styles the button as the primary action of its context.
The background becomes ColorToken::ACCENT, with
ColorToken::ACCENT_HOVER under the pointer and
ColorToken::ACCENT_PRESSED while a press is held, and the label
paints in ColorToken::ACCENT_TEXT. The focus ring paints in
ColorToken::ACCENT_TEXT too, because a ring in the focus color
could match the accent it is drawn over. The hovered, pressed and
focused patches replace the ones the button had, so call it before
setting patches of your own.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".