1.0.19 • Published 6 months ago

country-flag-svg v1.0.19

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

country-flag-svg

Lightweight loader for country flag SVG files. Designed for compatibility and simplicity, it helps map country codes directly to their corresponding flag SVG.

Features

  • Direct mapping of country codes to SVG flags
  • Support for commonly used country codes
  • Browser and Node.js compatible
  • No emoji dependencies (works on all platforms)

Installation

npm install country-flag-svg

Usage

import getFlagEmoji from 'country-flag-svg';

// Using country codes
const flagPath = await getFlagEmoji('US');
console.log(flagPath); // Returns SVG base64

// HTML Example
const img = document.createElement('img');
img.src = await getFlagEmoji('FR');
img.alt = 'France Flag';

Supported Countries

Includes support for most common country codes (US, FR, GB, JP, etc.). Returns empty string for unsupported codes.

Motivation

Created to provide consistent flag display across all platforms, especially Windows systems where emoji flags might not render properly due to geopolitics.

Attribution

Flag graphics provided by and copyright © Twemoji. Usage must comply with Twemoji licensing terms.

Contributing

Contributions welcome! Feel free to add country codes or improve existing implementations.

License

MIT License

1.0.19

6 months ago

1.0.18

6 months ago

1.0.17

6 months ago

1.0.15

6 months ago

1.0.14

7 months ago

1.0.13

7 months ago

1.0.12

7 months ago

1.0.11

7 months ago

1.0.10

7 months ago

1.0.9

7 months ago

1.0.8

7 months ago

1.0.7

7 months ago

1.0.6

7 months ago

1.0.5

7 months ago

1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago