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 1 month 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 (9 months ago)
- Default Branch: main
- Last Pushed: 2025-02-06T12:19:22.000Z (4 months ago)
- Last Synced: 2025-04-19T01:06:47.052Z (about 2 months ago)
- Language: TypeScript
- Homepage:
- Size: 380 KB
- Stars: 1
- 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
[](https://www.npmjs.com/package/@m234/nerd-fonts)
[](https://www.npmjs.com/package/@m234/nerd-fonts)
[](https://github.com/Mopsgamer/nerd-fonts)
[](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.
- NF meta and version included.
- Submodule exports.## Install
```bash
npm i @m234/nerd-fonts
```## Usage
Import:
```js
import * as nf from "@m234/nerd-fonts";
```Get an icon by class name:
```js
const icon = nf.icons['nf-md-weather_lightning']
console.log(`Weather: ${icon.value}`);
// >> Weather:
```Get an icon by file path:
```js
const file = 'example/index.js';
const ficon = nf.fromPath(file, 'seti');
console.log(`Icon ${ficon.value} for ${file}`);
// >> Icon for example/index.js
```Colors:
```js
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
```