Expand description
icons — the Lucide set, ported into typed constants. Reached as bezel::icons.
use ui::icons::{self, navigation};
icons::icon(navigation::Compass).size(px(16.0)).text_color(theme.text_muted)icon returns a gpui Svg, so it colors with text_color and sizes like
any element. ui’s theme.icon(..) is the same builder with both supplied
from the ladder and the palette, which is what app code should reach for.
§What a component takes
Icon is the value, and it erases where the drawing came from — a glyph
compiled in, the app’s Icon::asset source, or Icon::file off disk.
Components take impl Into<Icon>, so glyph::Search passes as itself and
neither the component nor its signature learns which it got. SwiftUI’s
Image erases its sources the same way.
An Icon carries no size and no colour. Those are the environment’s, which
here is the component: a menu row’s glyph is the row’s metric, not the
caller’s.
§The set
Modules are Lucide’s categories and constants are Lucide’s names, both
generated by build.rs from a pinned release — there is no curated list to
drift from upstream. A glyph Lucide files under two categories is one
constant re-exported twice, so glyph holds each exactly once.
A constant is the SVG itself rather than a path into an asset source, which
is what lets the linker drop an icon the app never names: the set costs a
binary only the glyphs it paints. Nothing registers with with_assets.
§Paying for what you paint
One feature per Lucide category, named as Lucide names it, and full is all
42. Nothing is on by default. Cargo unions features across a graph, so a
category a dependency turns on is the floor for everyone below it — ui
needs arrows, notifications and text.
CATEGORIES is every enabled category and its icons, for an icon browser.
Naming it is what pins the enabled set, so an app that only paints icons
never mentions it and keeps the linker’s dead-code pass.
Modules§
- glyph
- Every enabled glyph, under Lucide’s own name.
Structs§
- Icon
- What to paint: a drawing, and the variant of it. Every component that takes an icon takes this, so a glyph and an app’s own file are one signature.
Constants§
- CATEGORIES
- Every enabled category and its icons.
Functions§
- icon
- An icon element. Size and colour are the caller’s (
.size(..),.text_color(..)) — anSvgwith neither paints nothing, which is whyui’stheme.icon(..)supplies both and this is the floor under it. - solid
icon, painted solid —icons::solid(glyph::Play).
Type Aliases§
- Icons
- One category’s icons, each a name and the SVG itself.