Skip to content

Instantly share code, notes, and snippets.

@trackd
Created April 11, 2024 00:24
Show Gist options
  • Save trackd/e43f98f09749df4f44814fe9001545d9 to your computer and use it in GitHub Desktop.
Save trackd/e43f98f09749df4f44814fe9001545d9 to your computer and use it in GitHub Desktop.
function Get-NerdFontGlyphs {
<#
.SYNOPSIS
Get a list of all Nerd Font Glyphs
.EXAMPLE
Get-NerdFontIcons
.EXAMPLE
Get-NerdFontIcons -AsHashtable
.PARAMETER AsHashtable
Return the list as a hashtable
#>
param(
[Switch] $AsHashtable
)
$glyphs = (Invoke-RestMethod -Uri 'https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/glyphnames.json').psobject.properties |
Select-Object -Skip 1 |
ForEach-Object {
[PSCustomObject]@{
Name = 'nf-' + $_.Name
Glyph = $_.Value.char
Hex = $_.Value.code
Int = [int]"0x$($_.value.code)"
}
}
if ($AsHashtable) {
return $glyphs | Group-Object -Property Name -AsHashTable
}
$glyphs
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment