gpui-phosphor
gpui-phosphor is an unofficial community integration of the official
Phosphor Icons SVG assets with
GPUI. It embeds Phosphor Core 2.1.1, generates a typed
IconName enum from the SVG catalog, and renders icons with GPUI’s svg()
element.
It is not affiliated with or endorsed by Phosphor Icons.
Copyright (c) 2025-2026 eltrach. The Rust crate
is open source under MIT OR Apache-2.0. Phosphor’s original MIT license and
attribution remain preserved in LICENSE-PHOSPHOR.
Usage
Enable the asset source when constructing the GPUI application:
use ;
use ;
The component defaults to the first enabled weight, a 16px size, and the current GPUI text color:
use ;
use ;
let toolbar = div
.flex
.gap_2
.child
.child;
Use try_new or try_with_weight when a disabled weight should be handled as
a Rust error:
use ;
let duotone_heart = try_new;
IconName::path returns namespaced paths such as
phosphor/regular/heart.svg. The generated enum covers the complete catalog;
there is no hand-maintained icon list.
Combining asset sources
PhosphorAssets::with_fallback composes Phosphor with an existing application
asset source:
use ;
use PhosphorAssets;
use Cow;
;
let application = new
.with_assets;
Phosphor assets are served first; all other paths are delegated to the
fallback source. PhosphorAssets by itself serves only Phosphor paths.
Cargo features
Only regular is enabled by default. Each other weight is opt-in so the
compiled binary embeds only the styles an application uses:
[]
= { = "0.1", = ["regular", "fill", "duotone"] }
Available features are regular, thin, light, bold, fill, and
duotone. Weight::is_enabled and IconName::path expose the selected build
configuration, and a disabled weight produces an actionable IconError.
Licensing and attribution
The Rust crate is licensed under MIT OR Apache-2.0. The embedded Phosphor
SVG assets remain under the original Phosphor MIT license; see
LICENSE-PHOSPHOR and
THIRD_PARTY_NOTICES.md.