Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/reserve-protocol/elm-iso3166-data

ISO 3166 data including country names, flags sprite sheet, dial codes, and more
https://github.com/reserve-protocol/elm-iso3166-data

Last synced: about 1 month ago
JSON representation

ISO 3166 data including country names, flags sprite sheet, dial codes, and more

Awesome Lists containing this project

README

        

# elm-iso3166-data

Information about world countries. This library contains lists of facts about countries.

### Convert Alpha-2 Code to name
Find the name of a country including the country name in local language in parenthesis

### Convert Alpha-2 Code to flag
Find the flag of a country in this sprite sheet.

![Sprite sheet](assets/flag.png)

```elm
> import Iso3166
> Dict.get Iso3166.flagPositions "MX"
Just ( -112, -144 )
: Maybe.Maybe (Float, Float)
> import Html exposing (div)
> (x, y) = (-112, -144)
> div
[ style "background-image" ("url(\"" ++ Iso3166.flagImageData ++ "\")"
, style "background-position" (String.fromFloat x ++ "px " ++ String.fromFloat y ++ "px")
, style "width" "16px"
, style "height" "16px"
]
[]
```