Skip to content

lrstanley/go-nf

logo


πŸ”— Table of Contents

go-nf is a Go package that provides a type-safe way to access Nerd Font glyphs.

✨ Features

Warning

The scope and design of this module is still a work in progress, and may change before it is considered stable, and a v1.0.0 release is made.

  • βœ”οΈ Reference Nerd Font glyphs by their name, rather than hardcoding them as strings in your project. Ensures type safety, validation, and better documentation.
  • βœ”οΈ Split into multiple packages, per Nerd Font class, to reduce binary size and improve organization.
  • βœ”οΈ Helpers for resolving Nerd Fonts glyphs through specific identifiers -- file name, file extension, operating system, window manager, desktop environment, etc thanks to ported mappings from nvim-tree.
  • βœ”οΈ Detect if Nerd Fonts are installed on the system, to prevent using glyphs that are not available.
    • Note that this is not a perfect solution. Just because Nerd Fonts are installed, doesn't mean the font in question is actively being used in the associated terminal emulator.
  • βœ”οΈ Helpers for iterating over all glyphs, by class, ID, and more.

βš™οΈ Usage

go get -u github.com/lrstanley/go-nf@latest

Then, you can start referencing glyphs directly. For example, fa (Font Awesome) glyphs can be referenced like so:

package main

import (
    "fmt"

    "github.com/lrstanley/go-nf/glyphs/fa"
)

func main() {
    fmt.Println(fa.Heart)
}

πŸ‘ Examples

More examples provided below.

Simple example

  • Static glyph references, dynamic lookup by file extension, and font installation detection.
  • Example source

simple example

Package manager example

  • Bubble Tea TUI simulating package installation with glyphs per package type.
  • Example source

package-manager example


πŸ™‹β€β™‚οΈ Support & Assistance

  • ❀️ Please review the Code of Conduct for guidelines on ensuring everyone has the best experience interacting with the community.
  • πŸ™‹β€β™‚οΈ Take a look at the support document on guidelines for tips on how to ask the right questions.
  • 🐞 For all features/bugs/issues/questions/etc, head over here.

🀝 Contributing

  • ❀️ Please review the Code of Conduct for guidelines on ensuring everyone has the best experience interacting with the community.
  • πŸ“‹ Please review the contributing doc for submitting issues/a guide on submitting pull requests and helping out.
  • πŸ—οΈ For anything security related, please review this repositories security policy.

βš–οΈ License

MIT License

Copyright (c) 2026 Liam Stanley <liam@liam.sh>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Also located here

About

Nerd Font glyphs exported as a native Go package

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Contributors