NSGo Flag Icons NSGo GitHub 中文

Flag Icons for NSGo

271 country flags from flag-icons, in 4:3 and 1:1, drawn natively from SVG on every platform NSGo runs on.

The gallery: a grid of flags, and the chosen one with the code that draws it

Every flag, natively

The flags are flag-icons' own SVG, checked at build time against what NSGo's SVG reader draws.

Two ratios

Every flag in 4:3 and 1:1, from countries to subdivisions such as Scotland and organizations such as the EU.

Only what you use

An accessor per flag and no registry: an app links only the flags it calls.

Find by code

The catalog finds a flag by a code known at run time, such as a locale's region, with its English name.

Pinned upstream

Generated from one flag-icons commit, and checked against it in CI.

Get started

Add the library to an NSGo app with Go 1.26 or later.

go get github.com/nsgo-dev/nsgo-icons-flags
import flags "github.com/nsgo-dev/nsgo-icons-flags"

core.Icon{
	SVG:   flags.JP(),
	Style: core.Style{FontSize: 24},
	Label: "Japan",
}

JP is the 4:3 flag and JPSquare the 1:1 one. When the code is known only at run time, use the catalog:

import "github.com/nsgo-dev/nsgo-icons-flags/catalog"

if f, ok := catalog.Find("GB"); ok {
	core.Icon{SVG: f.SVG(), Style: core.Style{FontSize: 24}, Label: f.Name}
}

Find a flag

The gallery searches every flag by name, code or capital and shows the code that draws the one you choose, ready to copy. Run it from a checkout:

git clone https://github.com/nsgo-dev/nsgo-icons-flags
cd nsgo-icons-flags
go tool nsgo dev examples/gallery