Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mopsgamer/nerd-fonts
Get Nerd Fonts glyph icon character using a CSS class name or a file path with an extension.
https://github.com/mopsgamer/nerd-fonts
Last synced: about 2 months ago
JSON representation
Get Nerd Fonts glyph icon character using a CSS class name or a file path with an extension.
- Host: GitHub
- URL: https://github.com/mopsgamer/nerd-fonts
- Owner: Mopsgamer
- License: mit
- Created: 2024-09-18T18:39:55.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-10-10T09:33:10.000Z (3 months ago)
- Last Synced: 2024-10-10T10:43:34.365Z (3 months ago)
- Language: TypeScript
- Homepage:
- Size: 201 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# @m234/nerd-fonts
[![npm version](https://img.shields.io/npm/v/@m234/nerd-fonts.svg?style=flat)](https://www.npmjs.com/package/m234/nerd-fonts)
[![npm downloads](https://img.shields.io/npm/dm/@m234/nerd-fonts.svg?style=flat)](https://www.npmjs.com/package/@m234/nerd-fonts)
[![github](https://img.shields.io/github/stars/Mopsgamer/nerd-fonts.svg?style=flat
)](https://github.com/Mopsgamer/nerd-fonts)
[![github issues](https://img.shields.io/github/issues/Mopsgamer/nerd-fonts.svg?style=flat)](https://github.com/Mopsgamer/nerd-fonts/issues)Get Nerd Fonts glyph icon character using a CSS class name or a file path with an extension.
## Features
- 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.## Install
```bash
npm i @m234/nerd-fonts
```## Usage
```js
import nf from "@m234/nerd-fonts";
import chalk from "chalk";// # Class-name icon
const icon = nf.icons['nf-md-weather_lightning']
console.log(`Weather: ${icon.char}`); // Weather: // # File icon (seti)
const file = 'example/index.js';
const ficon = nf.FSC.fromPath(file, nf.FSC.mappings.seti);
console.log(`Icon ${ficon.char} for ${file}`); // Icon for example/index.js// # Colored
const colorHex = ficon.color.toString(16)
const colorize = chalk.hex(colorHex)
console.log(`Icon ${colorize(ficon.char)} for ${file}`); // Icon for example/index.js
```