ph_fill {phosphoricons}R Documentation

Fill SVG icon

Description

Fill an SVG icon with different colors according to breaks.

Usage

ph_fill(icon, colors, breaks, orientation = c("vertical", "horizontal"))

Arguments

icon

An icon generated with ph().

colors

Colors to fill icon with.

breaks

Breaks where to switch colors.

orientation

Orientation of color filling: vertical (from bottom to top), horizontal (from left to right).

Value

An SVG tag.

Examples

library(phosphoricons)
ph_fill(
  ph("heart", weight = "fill", height = 128),
  colors = c("#DF0101", "#F6CECE"),
  breaks = 0.7
)

ph_fill(
  ph("star", weight = "fill", height = 128, stroke = "gold", `stroke-width` = 10),
  colors = c("gold", "#FFF"),
  breaks = 0.5,
  orientation = "h"
)


# Multiple colors:
ph_fill(
  ph("trash", weight = "fill", height = 128),
  colors = c("forestgreen", "firebrick", "steelblue", "gold"),
  breaks = c(0.3, 0.6, 0.9)
)


[Package phosphoricons version 0.2.1 Index]