fa_png | R Documentation |
Get a Font Awesome icon as a PNG file. We can optionally set the fill
attribute before writing the PNG. Additionally, there is control over the
output width and height (usually, icons are 512 by 512 pixels). Please note
that this function requires that the rsvg is installed on the system.
Attempting to use fa_png()
without rsvg available will result in an
error message.
fa_png(
name,
file = NULL,
fill = NULL,
fill_opacity = NULL,
stroke = NULL,
stroke_width = NULL,
stroke_opacity = NULL,
height = NULL,
width = NULL,
prefer_type = c("regular", "solid")
)
name |
The name of the Font Awesome icon. |
file |
the path to the output file. If |
fill, fill_opacity |
The fill color of the icon can be set with |
stroke, stroke_width, stroke_opacity |
The stroke options allow for
setting the color, width, and opacity of the outline stroke. By default,
the stroke width is very small at |
height, width |
The output height and width of the rendered PNG. If nothing is provided then the output dimensions will match that of the input SVG viewBox. |
prefer_type |
Chooses the type of icon returned if: (1) providing a
short name, and (2) that icon has both solid and regular types.
For example, using |
A PNG file written to disk.
if (interactive()) {
# Create a Font Awesome SVG icon as a
# PNG file on disk
fa_png(name = "r-project")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.