Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flagme

Type the countries, get the flags. A single-page generator for the flag heritage meme doing the rounds on Bluesky:

Live in: 🇨🇦
Born in: 🇨🇦
Parents: 🇨🇦🇨🇦
Grandparents: 🇮🇪🇨🇦🇨🇦🇨🇦
Great grandparents: 🇮🇪🇮🇪🇵🇱🇵🇱🇨🇦🇨🇦🇨🇦🇨🇦
Been to: 🇺🇸🇲🇽🇨🇺🇨🇴🇮🇸

Live at flagme.tforster.com.

Table of Contents

1. How It Works

Three static files, no build step, no dependencies, no framework.

  • The country catalogue is generated in the browser at load: every two-letter code from AA to ZZ is passed through Intl.DisplayNames, and the ones the browser recognises become the list. No country data ships with the app, and it stays current with the browser's own ICU tables.
  • Codes are then filtered through Intl.Locale, keeping only canonical ones. CLDR still answers to deprecated aliases — UK for GB, DD for DE, SU for RU, sixteen in all — and none of those have emoji flags, so admitting them is what turns "United Kingdom" into a broken glyph instead of a Union Jack. Kosovo is excluded for the same reason: it is the one current country with no flag emoji.
  • Flags are derived from the code — regional indicator pairs for countries, tag sequences for England, Scotland and Wales.
  • Each row is an ARIA 1.2 combobox over a listbox: arrow keys to review, Enter to add, Escape to dismiss, Backspace to remove the last chip. Matching runs prefix, then substring, then bounded Levenshtein distance, so "united kindom" still finds the United Kingdom while "narnia" finds nothing.
  • Built to WCAG 2.1 Level AA and verified with axe-core in light and dark schemes.
  • Selections persist to localStorage, and are also encoded into a ?m= share link (CA-CA-CA.CA-IE.CA.CA.CA-…).
  • Copy writes both text/plain and text/html to the clipboard, so rich targets get "created by flagme" as a real hyperlink and plain targets get the URL inline.

2. Development

npm install
npm run dev

3. Deployment

Deployed to Cloudflare Workers as a static assets project. There is no Worker script — wrangler.jsonc points at ./public and the edge serves it directly.

npm run deploy

About

Type the countries, get the flags. Zero-dependency generator for the flag heritage meme.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages