Gathering detailed insights and metrics for iso3166-flags
Gathering detailed insights and metrics for iso3166-flags
🌎 A verbose collection of all ISO 3166-1 and ISO 3166-2 flags from around the world 🌎
npm install iso3166-flags
Typescript
Module System
Node Version
NPM Version
CSS (86.68%)
Python (12.49%)
Shell (0.83%)
Total Downloads
463
Last Day
3
Last Week
18
Last Month
56
Last Year
289
1 Stars
34 Commits
1 Watching
3 Branches
1 Contributors
Latest Version
1.0.1
Package Id
iso3166-flags@1.0.1
Unpacked Size
4.16 MB
Size
866.52 kB
File Count
273
NPM Version
9.1.1
Node Version
16.14.2
Cumulative downloads
Total Downloads
Last day
0%
3
Compared to previous day
Last week
80%
18
Compared to previous week
Last month
0%
56
Compared to previous month
Last year
261.3%
289
Compared to previous year
No dependencies detected.
A comprehensive library of all ISO3166-1 & ISO3166-2 country/subdivision codes and their corresponding flag icons in SVG format. View demo here (repo).
iso3166-flag-icons is a comprehensive repository of all ISO 3166-1 and ISO 3166-2 flag icons according to the International Organisation for Standard that defines codes for the names of countries, dependent territories, special areas of geographical interest, and their principal subdivisions [1]. The repo contains 266 ISO3166-1 alpha-2 flag icons and over 3200 ISO3166-2 flags.
The ISO 3166-1 icons are those of the names of countries and their subdivisions that can be broken into three sets of country codes:
The ISO 3166-2 icons are those of the names of countries and their subdivisions – Part 2: Country subdivision code, defines codes for the names of the principal subdivisions (e.g., provinces, states, departments, regions) of all countries coded in ISO 3166-1 [2].
The ISO 3166-3 icons are those of countries and their subdivisions – Part 3: Code for formerly used names of countries, defines codes for country names which have been deleted from ISO 3166-1 since its first publication in 1974.
The main motivation behind this project was to integrate additional flag icons into my custom-built web-app Flagle (https://flagle.vercel.app/). This daily worldle-inspired game generates a new flag from around the world each day, consisting of flags of countries, territories and everywhere in between.
After searching around, it was fairly straightforward to find a repo with ISO 3166-1 flags, an example being here but there didn't seem to be any single repo/dataset of all ISO 3166-2 subdivision flags, hence I decided to make one from scratch.
A zipped folder of all ISO 3166-1 OR ISO 3166-2 flag icons are available to download in the /downloads folder of the repo.
The whole project can be cloned from git:
git clone https://github.com/amckenna41/iso3166-flag-icons.git
The ISO 3166-1 and ISO 3166-2 are also split into branches and be downloaded seperately:
git clone -b iso3166-1-icons https://github.com/amckenna41/iso3166-flag-icons.git
OR
git clone -b iso3166-2-icons https://github.com/amckenna41/iso3166-flag-icons.git
Install via npm or yarn (not implemented yet):
npm install --dev iso3166-flag-icons
yarn add --dev iso3166-flag-icons
The flags can be implemented in-line by referencing the CSS class of the respective flag using the ISO 3166-1 or ISO 3166-2 CSS file. For ISO 3166-1 icons add the classes .fi
and .fi-xx
(where xx
is the ISO 3166-1-alpha-2 code [5] of a country) to an empty <span>
. To add a squared version flag then additionally add the class fis
. Example:
1<span class="fi fi-ad"></span> <span class="fi fi-ad fis"></span>
For ISO 3166-2 icons add the classes .fi
and .fi-xx-yy
(where xx
is the ISO 3166-1-alpha-2 code [2] of a country and yy
is the ISO 3166-2 code, both in lower-case) to an empty <span>
. For example to import the flag for the Canillo Parish of Andorra:
1<span class="fi fi-ad-02"></span> <span class="fi fi-ad-02 fis"></span>
/iso3166-1-icons
- flags of all country/territories/subdivisions according to the ISO 3166-1 standard [5]./iso3166-2-icons
- flags of all subdivisions within countries/territories according to the ISO 3166-2 standard [2]./scripts
- various Python and bash scripts created for downloading and compressing all the required flag SVG files for both the ISO 3166-1 and ISO 3166-2 icons, as well as scripts for creating the json, CSS and readme files./downloads
- directory of zipped iso3166-1 and iso3166-2 flag icons files./css
- css scripts for integrating the flags into front-end projects.index.html
- front-end demo for iso3166-flag-icons repo.iso3166-1.json
- json containing all ISO 3166-1 country names, 2 letter codes and relative path to flag icon in repo.iso3166-2.json
- json containing all ISO 3166-2 country names, 2 letter codes, all subdivision codes and common names as well as all info pulled per country via the restcountries api (https://restcountries.com/).iso3166-2-min.json
- minimised json containing all ISO 3166-2 country names, 2 letter codes and all subdivision codes and common names.Due to the nature of the methodology for getting the ISO 3166-2 subdivision flags, as well as the verbosity of flags included, there may exist several outstanding issues with the existing flag icons. A list of countrys that have no recognised subdivisions and hence no flags in iso3166-2 is listed in the file scripts/iso3166-files/noISO3166-2Flags.csv. Another outstanding issue is some ISO3166-2 flags not having an existing or easily accessible SVG version of their flag hence some flags are in png/jpg/gif format. Please feel free to do a PR if SVG versions of these flags become available.
Please feel free to raise an Issue in the Issues tab if any incorrect/missing subdivision flags as well as any errors/bugs are found
If you have any questions or feedback, please contact amckenna41@qub.ac.uk or visit my LinkedIn:
Distributed under the MIT License. See LICENSE
for more details.
[1]: https://en.wikipedia.org/wiki/ISO_3166
[2]: https://en.wikipedia.org/wiki/ISO_3166-2
[3]: https://github.com/lipis/flag-icons
[4]: https://github.com/amckenna41/flagle
[5]: https://en.wikipedia.org/wiki/ISO_3166-1
No vulnerabilities found.
No security vulnerabilities found.