Get Nerd Fonts glyph icon character using a CSS class name or a file path with an extension.
- Get Nerd Fonts icons by css class names: 10K+ icons.
- Give a file path or a parsed object - get icon. Seti theme support with colors.
- Built-in typescript declarations.
- NF meta and version included.
- Submodule exports.
npm i @m234/nerd-fonts
Import:
import * as nf from "@m234/nerd-fonts";
Get an icon by class name:
const icon = nf.icons['nf-md-weather_lightning']
console.log(`Weather: ${icon.value}`);
// >> Weather:
Get an icon by file path:
const file = 'example/index.js';
const ficon = nf.fromPath(file, 'seti');
console.log(`Icon ${ficon.value} for ${file}`);
// >> Icon for example/index.js
Colors:
import chalk from "chalk";
const file = 'example/index.js';
const ficon = nf.fromPath(file, 'seti');
const colorize = chalk.hex(ficon.color)
console.log(`Icon ${colorize(ficon.value)} for ${file}`);
// >> Icon for example/index.js