icon_path: Get the file path of an icon

View source: R/icon.R

icon_pathR Documentation

Get the file path of an icon

Description

Icons created from an SVG file (such as those from an icon_set(), or read directly with read_icon()) retain the path to their source file. This is useful for passing icons to other packages that work with SVG files directly, such as ggplot2 (via grid::rasterGrob() or similar) or gt.

Usage

icon_path(x)

Arguments

x

An icons vector.

Value

A character vector giving the path(s) to the icon's source SVG file(s) on disk.

Examples

path <- tempfile(fileext = ".svg")
writeLines(
  '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0"/></svg>',
  path
)
icon_path(read_icon(path))


icons documentation built on Sept. 3, 2026, 5:10 p.m.