Inspired by splendid Country Code 🔡 ➡️ Emoji Flag 🇬🇧 library
I let myself quote a part of their equally excellent README
An image file equivalent to an emoji symbol may be tens, hundreds of kilobytes in size, while an emoji symbol is only several bytes. That's a bandwidth saving of around 10,000 times. If you use emoji instead of image files, you reduce your carbon footprint.
To use UnicodeEmojiFlag in your Mix projects, added it is a dependency in mix.exs
:
def deps do
[
{:unicode_emoji_flag, "~> 1.0"}
]
end
UnicodeEmojiFlag.html
takes two characters-long country code and produces an HTML-ready hexadecimal representation of its flag.
For example in your Phoenix template <%= raw(UnicodeEmojiFlag.html("tw")) %>
UnicodeEmojiFlag.console
takes two characters-long country code and produces a Unicode sequence ready to be printed to a terminal
Thanks to folks at Elixir Slack helping out with nailing down printing Unicode sequences to a terminal - @micahbf, @di4na, Jaxon Axelson and @lostkobrakai