Home

Awesome

<!-- README.md is generated from README.Rmd. Please edit that file -->

phosphoricons

<!-- badges: start -->

version Codecov test
coverage R-CMD-check

<!-- badges: end -->

R wrapper for using Phosphor Icons in shiny applications or rmarkdown documents. Visit phosphoricons.com for a list of all available icons.

Installation

Install from CRAN with:

install.packages("phosphoricons")

You can install development version from GitHub with:

remotes::install_github("dreamRs/phosphoricons")

Icons usage

Create an icon with ph() function:

library(phosphoricons)
ph("lightning")
<img src="man/figures/lightning-light.svg" height="32" />

There’s 5 weights available:

ph("lightning", weight = "thin")
<img src="man/figures/lightning-thin.svg" height="32" />
ph("lightning", weight = "light")
<img src="man/figures/lightning-light.svg" height="32" />
ph("lightning", weight = "regular")
<img src="man/figures/lightning-regular.svg" height="32" />
ph("lightning", weight = "bold")
<img src="man/figures/lightning-bold.svg" height="32" />
ph("lightning", weight = "fill")
<img src="man/figures/lightning-fill.svg" height="32" />

Colorize icon using fill argument:

ph("lightning", weight = "bold", fill = "gold")
<img src="man/figures/lightning-bold-gold.svg" height="32" />

There’s two type of icons:

There’s a big debate between Web Fonts vs SVG for icons, but mainly:

Bonus

Fill icon according to percentage:

ph_fill(
  ph("heart", weight = "fill", height = 128),
  colors = c("#DF0101", "#F6CECE"),
  breaks = 0.7
)
<img src="man/figures/icon-fill-perc-1.svg" height="128" />
ph_fill(
  ph("star", weight = "fill", height = 128, stroke = "gold", `stroke-width` = 10),
  colors = c("gold", "#FFF"),
  breaks = 0.5,
  orientation = "h"
)
<img src="man/figures/icon-fill-perc-2.svg" height="128" />

Icon waffle:

waffle_icon(
  values = sample(c("Cats", "Dogs"), 200, TRUE),
  colors = list(
    Cats = "#456990",
    Dogs = "#F45B69"
  ),
  icons = list(
    Cats = ph("cat", height = NULL),
    Dogs = ph("dog", height = NULL)
  ),
  ncol = 15,
  nrow = 8,
  width = "500px"
)