Every icon sourced from an installed icon library (as opposed to a local icon_set() or a raw read_icon() file) has a file path of the form <cache root>/<library>/<...name parts...>.svg (see 00_registry.R's icon_fn$get()), which is exactly the library$sub$name expression used to access it. icon_label() recovers that label straight from icon_path() rather than requiring a name to be tracked separately — so, unlike names(), it survives c()/rep()/subsetting on an icon_vec (a vctrs rcrd, which cannot carry element names()).

icon_label(x)

Arguments

x

An icon or icon_vec object.

Value

A character vector the same length as x giving each icon's library$sub$name label. Icons not sourced from an installed library (a local icon_set() or a read_icon() file outside the icon cache) return NA.