Skip to main content

Module icon_widget

Module icon_widget 

Source
Expand description

IconWidget — a vector or raster icon rendered at a configurable size.

Supports multiple source formats: programmatic Path (checkmarks, chevrons, dots), SVG strings, PNG, static WebP, and animated WebP. Icons default to tintable mode — the pixels are treated as an alpha mask and multiplied by the widget’s color property (defaults to TextRole::Primary) so they follow theme switches automatically. IconMode::FullColor preserves original pixel colors and is appropriate for emoji-style graphics or brand logos.

For arbitrary-aspect-ratio photos or artwork see ImageWidget.

§Accessibility

Icons are decorative by default — they set no accessibility role and announce nothing. The parent widget (e.g. Button, IconButton) is responsible for the accessible label.

let _check = IconWidget::checkmark(20.0);

let _chevron = IconWidget::chevron_down(16.0)
    .color(TextRole::Primary)
    .follow_text_scale(false);

Structs§

IconWidget
A leaf widget that renders an icon from a path, SVG string, PNG, or WebP source.

Enums§

IconMode
Whether an icon is rendered as a theme-tinted mask or in its original colors.