| Title: | 'Phosphor' Icons for R | 
| Version: | 0.2.1 | 
| Description: | Use 'Phosphor' icons in 'shiny' applications or 'rmarkdown' documents. Icons are available in 5 different weights and can be customized by setting color, size, orientation and more. | 
| License: | MIT + file LICENSE | 
| Encoding: | UTF-8 | 
| RoxygenNote: | 7.3.1 | 
| Depends: | R (≥ 2.10) | 
| Imports: | htmltools (≥ 0.3) | 
| Suggests: | covr, shiny, tinytest | 
| URL: | https://dreamrs.github.io/phosphoricons/, https://github.com/dreamRs/phosphoricons | 
| BugReports: | https://github.com/dreamRs/phosphoricons/issues | 
| NeedsCompilation: | no | 
| Packaged: | 2024-04-08 05:45:05 UTC; perri | 
| Author: | Victor Perrier [aut, cre, cph], Fanny Meyer [aut], Phosphor Icons [cph] (Phosphor Icons <https://github.com/phosphor-icons>) | 
| Maintainer: | Victor Perrier <victor.perrier@dreamrs.fr> | 
| Repository: | CRAN | 
| Date/Publication: | 2024-04-08 06:12:59 UTC | 
HTML dependency for Phosphor Icons
Description
Allow to explicitly load dependency for using Phosphor icons.
Usage
html_dependency_phosphor()
Value
An htmltools::htmlDependency() object.
Note
Dependency is automatically loaded when using ph_i(), but in some case,
like when using icon argument in some function, you might need to call html_dependency_phosphor() to make icons appears.
Examples
library(shiny)
library(phosphoricons)
ui <- navbarPage(
  title = "Phosphor Icons",
  header = list(
    html_dependency_phosphor()
  ),
  tabPanel("Home", icon = ph_i("house")),
  tabPanel("Parameters"),
  tabPanel("Results")
)
server <- function(input, output, session) {
  
}
if (interactive())
  shinyApp(ui, server)
Phosphor SVG Icons
Description
Create a <svg></svg> tag to render an icon.
Usage
ph(
  name,
  weight = c("light", "regular", "thin", "bold", "fill"),
  fill = "currentColor",
  rotate = NULL,
  height = "1.33em",
  width = NULL,
  vertical_align = "-0.25em",
  title = name,
  ...
)
Arguments
| name | Name of the icon to use. | 
| weight | Weight of icon (from thinnest to thickest):  | 
| fill | Fill color for the icon, default is  | 
| rotate | Numeric, angle to rotate the icon. | 
| height,width | Height and width in valid CSS unit. | 
| vertical_align | Vertical alignment for the icon, this depend on the size of the icon. | 
| title | Add a  | 
| ... | Attributes passed to the SVG tag. | 
Value
An SVG tag.
Examples
library(phosphoricons)
ph("airplane-tilt")
ph("airplane-tilt", weight = "thin")
ph("airplane-tilt", weight = "bold")
ph("house")
ph("house", fill = "#F45B69")
ph("cake", rotate = 45)
ph("airplane-tilt", height = 128)
ph("airplane-tilt", height = 128, weight = "fill")
ph("airplane-tilt", height = 128, weight = "fill", fill = "steelblue")
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  | 
| colors | Colors to fill icon with. | 
| breaks | Breaks where to switch colors. | 
| orientation | Orientation of color filling:  | 
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)
)
Phosphor Font Icons
Description
Create a Phosphor icon with font files.
Usage
ph_i(
  name,
  weight = c("light", "regular", "thin", "bold", "fill"),
  size = c("lg", "xxs", "xs", "sm", "xl", "1x", "2x", "3x", "4x", "5x", "6x", "7x", "8x",
    "9x", "10x"),
  color = NULL,
  ...
)
Arguments
| name | Name of the icon to use. | 
| weight | Weight of icon (from thinnest to thickest):  | 
| size | Size of icon. | 
| color | Color of icon: use valid HTML color or hex code. | 
| ... | Attributes passed to the  | 
Value
An HTML tag.
Examples
library(phosphoricons)
ph_i("airplane-tilt")
ph_i("airplane-tilt", weight = "thin")
ph_i("airplane-tilt", weight = "bold")
ph_i("house")
ph_i("house", color = "#F45B69")
ph_i("cake")
ph_i("cake", size = "xl")
ph_i("cake", size = "10x")
Search Icons
Description
Search Icons
Usage
search_icon(pattern, output = c("viewer", "console"))
Arguments
| pattern | Pattern to search for in icon's name. | 
| output | View results in the viewer or in the console. | 
Value
If output = "console" a character vector, if output = "viewer" a shiny.tag.
Examples
search_icon("calendar")
search_icon("text")
Waffle plot with icons
Description
Waffle plot with icons
Usage
waffle_icon(
  values,
  colors,
  icons,
  ncol = 10,
  nrow = 10,
  flow = c("row", "column"),
  legend = TRUE,
  width = NULL
)
Arguments
| values | A vector of values to be plotted. | 
| colors | Colors to use for each unique values. | 
| icons | Icon or list of icons associated to unique values. | 
| ncol,nrow | Number of column and row in the matrix. | 
| flow | Populate matrix by rows or columns. | 
| legend | Logical, display or not a legend. | 
| width | Width of the matrix. | 
Value
HTML tags.
Examples
library(phosphoricons)
waffle_icon(
  values = sort(sample(c("Aa", "Bb", "Cc"), 100, TRUE)),
  colors = c("#81F4E1", "#56CBF9", "#FF729F"),
  icons = ph("user", weight = "fill", height = 32)
)
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"
)