Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Sep 21, 2022. It is now read-only.

Polymer Web Component for SVG and PNG icons of country, state, province and other flags.

License

NotificationsYou must be signed in to change notification settings

stevenrskelton/flag-icon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

144 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

You are probably looking for the

<flag-icon>

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

CanadaKoreaGermanyAustraliaFranceEuropean UnionAngolaBelgiumAustriaMozambiqueNorwayPhilippinesSpainUnited KingdomIndiaCosta RicaSouth AfricaThailandSri LankaSwedenSloveniaPapua New GuineaMaldivesUnited StatesJapanIrelandBermudaIsle of ManMontenegroNorfolk IslandItalyBrazilIcelandPuerto RicoVenezuelaSaint LuciaRussian FederationPolandNetherlandsChinaVietnamMexicoFijiGabonGreeceGrenadaIraqIsraelKenyaKiribatiLatviaLiechtensteinLuxembourgMacedoniaMaltaMicronesiaMartiniqueMayotteNigeriaNew CaledoniaOmanPanamaPeruQatarSamoaCabo VerdeSyriaThailandUkraineBulgariaBurkina FasoUnited Nations

4:3 ratio SVG

CanadaKoreaGermanyAustraliaFranceUnited StatesNorwayPhilippinesSpain

Square ratio SVG

CanadaKoreaGermanyAustraliaFranceUnited StatesNorwayPhilippinesSpain

States and Provinces

CaliforniaDelawareFloridaIllinoisMaineMichiganNevadaNorth CarolinaTexas

Australian Capital TerritoryNew South WalesNorthern TerritoryQueenslandSouth AustraliaTasmaniaVictoriaWestern Australia

Rio de JaneiroRio Grande do NorteRio Grande do SulRondôniaRoraimaSanta CatarinaSão PauloSergipetocantins

AlbertaBritish ColumbiaManitobaNew BrunswickNewfoundland and LabradorNorthwest TerritoriesNova ScotiaNunavutQuébec'

BrandenburgBerlinRhineland-PalatinateSaarlandHamburgLower SaxonySaxonySchleswig-HolsteinThuringia

AndalucíaAragónAsturiasBalearic IslandsBasque CountryCanary IslandsCantabriaCastile and LeónLa Rioja

AdygeaBuryatiaChuvashiaIngushetiaTuvaKamchatkaStavropolBelgorodNovgorod

GreenYellowBlackYellow SaltireYellow SlashBlack White Per BendVertical StripesOrange CircleCheckered

CharlieAlphaRomeoNovemberOscarVictorLima13

Demos

Live Demo - General Use

Live Demo - Themes and Popover

Usage

  1. Add the library using the Javascript package managerBower:

    bower install --save flag-icon

  2. Import Web Components' polyfill:

    <scriptsrc="bower_components/webcomponentsjs/webcomponents.min.js"></script>
  3. Import Custom Element:

    <linkrel="import"href="bower_components/flag-icon/flag-icon.html">
  4. 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>
  5. 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' }

Options

AttributeTypeDefaultDescription
keystringnullProper, common, ISO 3166-1 alpha-2, alpha-3, or country code
imgattributefalseUse PNGs instead of larger filesize SVG
widthinteger16Width of icon (aspect ratio maintained ifheight omitted).
heightintegerautoHeight of icon (aspect ratio maintained ifwidth omitted).
aubooleanfalseAustralia Australian State flags
brbooleanfalseBrazil Brazilian State flags
cabooleanfalseCanada Canadian Province and Territory flags
debooleanfalseGermany German State flags
esbooleanfalseSpain Spain Autonomous Community flags
rubooleanfalseRussia Russian Republics, Krais, and Oblast flags
usbooleanfalseUnited States US State flags
maritimebooleanfalseMaritime and ICS flags
racingbooleanfalseNASCAR and IndyCar racing flags
squarebooleanfalseUse square version instead of 4:3 aspect (only valid for country flags)
aspectfloatOverride aspect ratio used to render the flag

Aspect Ratios for Flags

Flags come in all different shapes and sizes, attempts were made to standardize to the following aspect ratios (width:height)

AttributeAspect
Country4:3
Austrialia2:1
Brazil3:2
Canada2:1
Germany5:3
Spain3:2
US3:2
Russia3:2
NASCAR, IndyCar4:3
Maritime1:1

Todo

  • Loading notification, or default image.
  • Compact/minify SVG files

History

For detailed changelog, checkReleases.

License

MIT License © Steven Skelton

About

Polymer Web Component for SVG and PNG icons of country, state, province and other flags.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors4

  •  
  •  
  •  
  •  

Languages


[8]ページ先頭

©2009-2026 Movatter.jp