phospher

Inline icon fetcher module for Phospher Icons. Returns SVG for a Phospher icon based on name and style.

Use

ph = require("phospher")
ph.icon(name, [style], [class], [fill])

Example

ph = require("phospher")
atom_svg = ph.icon("atom")
github_svg = ph.icon("github-logo", "duotone")
blue_icon = ph.icon("bell", "bold", "my-icon", "blue")

API Reference

icon(name, [style], [class], [fill])

Returns SVG string for the requested Phospher icon.

Parameters:

Returns:

Styles

Config

Set defaults in the phospher.du datastore. All optional.

ph_ds = datastore("phospher.du")

ph_ds.set("cfg_local", "path to store / load cached icon files")
ph_ds.set("cfg_default_style", "icon style to default to")
ph_ds.set("cfg_class", "CSS class to inject into SVG elements")
ph_ds.set("cfg_fill", "SVG fill color to inject into elements")
ph_ds.set("cfg_placeholder", "svg source for icons not found by name")
ph_ds.set("cfg_cdn", "url for icon CDN source")

Caching

The module supports caching. Be aware if you bundle inside your app you will want to define a true local path to use for storing new icons. Otherwise it will default to the bundled folder. This works for loading but not for saving since the local vfs of a bundled app is read-only.

Attribution

Icons provided by Phosphor Icons — a free, extensive icon set under the MIT License.

Source: phosphor-icons/core