- Notifications
You must be signed in to change notification settings - Fork70
Polymer Web Component for SVG and PNG icons of country, state, province and other flags.
License
stevenrskelton/flag-icon
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
You are probably looking for the
https://github.com/lipis/flag-icons SVG flag library.
This is an undated Polymer 0.5.5 Web Component
A collection of SVG flags, conveniently usable as a Polymer Web Component.
If you don't care about extra features, a simple CSS implementation of country flags can be found athttps://github.com/lipis/flag-icon-css
Typical file sizes:
SVG files:2kb to75kb
PNG files: 16x11 <1kb, 36x27 <2kb, 75x56 <5kb, 225x168 <20kb
Tiny 16 x 11 PNG icons
4:3 ratio SVG
Square ratio SVG
- Images come fromfamfamfam icon library, or generated from SVG.
- SVGs come fromWikimedia Commons.
- PNGs are compacted usingpngcrush.
- ISO 3166-1 Country Code list is available on Wikipedia.
Add the library using the Javascript package managerBower:
bower install --save flag-iconImport Web Components' polyfill:
<scriptsrc="bower_components/webcomponentsjs/webcomponents.min.js"></script>
Import Custom Element:
<linkrel="import"href="bower_components/flag-icon/flag-icon.html">
Start using it!
<flag-iconkey="ca"></flag-icon><flag-iconkey="canada"></flag-icon><flag-iconkey="124"></flag-icon><!-- specify to use PNGs --><flag-iconkey="ca"img></flag-icon><!-- specify a specific size --><flag-iconkey="ca"width="100"></flag-icon><!-- Specify alt & title text, otherwise it defaults to the official country name --><flag-iconkey="can">Flag of Canada</flag-icon>
Or use it unrendered in scripts:
varf=newFlagIcon();//get country infof.findCountry('canada')//> { name: 'Canada', alpha2: 'CA', alpha3: 'CAN', numeric: 124 }//convert between 2 -> 3 letter character codesf.findCountry('ca').alpha3//> 'CAN'//get full names of states or provincesf.findUSState('ca')//> { name: 'California', iso: 'US-CA', alpha2: 'CA', numeric: 6, gpo: 'Calif.' }f.findCanadianProvince('ON')//> { name: 'Ontario', alpha2: 'ON' }
Flags come in all different shapes and sizes, attempts were made to standardize to the following aspect ratios (width:height)
| Attribute | Aspect |
|---|---|
| Country | 4:3 |
| Austrialia | 2:1 |
| Brazil | 3:2 |
| Canada | 2:1 |
| Germany | 5:3 |
| Spain | 3:2 |
| US | 3:2 |
| Russia | 3:2 |
| NASCAR, IndyCar | 4:3 |
| Maritime | 1:1 |
- Loading notification, or default image.
- Compact/minify SVG files
For detailed changelog, checkReleases.
MIT License © Steven Skelton
About
Polymer Web Component for SVG and PNG icons of country, state, province and other flags.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors4
Uh oh!
There was an error while loading.Please reload this page.