News for hackers. Stuff that matters.
Re:Country Flags in SVG by abbe98 on Friday February 04, 2022 @07:32AM (#30205963)
If one is looking for public domain versions with the correct proportions, Wikimedia Commons might have what you need:

https://commons.wikimedia.org/wiki/Sovereign-state_flags

Re:Country Flags in SVG by 0xdada on Friday February 04, 2022 @08:32AM (#30206543)
This one has the correct colors as well.
Re:Country Flags in SVG by Kwpolska on Friday February 04, 2022 @10:13AM (#30207723)
Weelll… that page lists the #ffffff version of the flag of Poland [0]. The law specifies the color using a strange color scale (CIELUV [1]), and it was written in the 1980s with fabric in mind, which cannot be a pure white - so the color translates to #E9E8E7, looking like [2]. This was the subject of a flamewar on Polish Wikipedia around 2006, which also involved a light-pink version [3] due to someone miscalculating the colors. In the end, en.wiki uses the #fff version [4], and pl.wiki uses the grey version in the flag article [5] and the white version anywhere else [6].

And a few months ago, the government proposed an amendment to the law. That lists #ffffff as the official color (for non-textile use). But it will probably take some time until it actually goes into force, if it ever will…

tl;dr: colors are hard, flag colors specified by 1980s laws doubly so.

[0] https://commons.wikimedia.org/wiki/File:Flag_of_Poland.svg [1] https://en.wikipedia.org/wiki/CIELUV [2] https://commons.wikimedia.org/wiki/File:Flag_of_Poland_(norm... [3] https://commons.wikimedia.org/wiki/File:Flaga_Polski_strange... [4] https://en.wikipedia.org/wiki/Flag_of_Poland [5] https://pl.wikipedia.org/wiki/Flaga_Polski [6] https://pl.wikipedia.org/wiki/Polska

Re:Country Flags in SVG by wisam on Friday February 04, 2022 @10:27AM (#30207978)
... and aspect ratios. Country flags are not (almost) squared as in the OP link.
Re:Country Flags in SVG by vbezhenar on Friday February 04, 2022 @06:56AM (#30205669)
Kazakhstan flag just flat out wrong. It looks similar, and that's about it. Compare:

https://www.akorda.kz/assets/media/flag_mediumThumb.jpg

https://flagicons.lipis.dev/flags/4x3/kz.svg

https://upload.wikimedia.org/wikipedia/commons/d/d3/Flag_of_...

Wikipedia's version looks like a very good recreation and probably should be used instead.

Re:Country Flags in SVG by vesinisa on Friday February 04, 2022 @07:11AM (#30205792)
Whoa, that is indeed a really bad approximation. The site notes that all the flags are forced to 4:3 so many of them need to be retouched (few real sovereign flaga are in this ratio). But that's just really bad approximation - the sun and eagle are way out of proportion.

I noticed also that Bouvet Island (bv) is represented by an almost comically bad version of the Norwegian flag. Finally, many of the colors are off, e.g. flag of Saudi Arabia.

This site is dangerous - by using these ridiculously incorrect flags you actually risk offending certain users.

Re:Country Flags in SVG by esrauch on Friday February 04, 2022 @09:07AM (#30206895)
Was the flag changed/corrected or are you actually saying that about "it will be offensive that the eagle is too big"?

I feel like it would be pretty weird for someone to get offended because the eagle was exactly correct but too large on the flag.

Re:Country Flags in SVG by vesinisa on Friday February 04, 2022 @09:55AM (#30207485)
Flags are extremely powerful national symbols. Many countries have laws criminizalizing defacing the national flag. For example India: https://en.wikipedia.org/wiki/Prevention_of_Insults_to_Natio...

US: https://www.law.cornell.edu/uscode/text/18/700

If you do not know the specific history regarding why the proportions of some national flag are as they are, I would be very careful about altering those. Although probably not criminal in most places, showing an incorrect flag can still cause offense and draw disfavourable attention to the publisher who uses the incorrect flag.

Re:Country Flags in SVG by sgjohnson on Friday February 04, 2022 @02:23PM (#30211631)
18 USC § 700 is unenforceable.

There has been a Supreme Court precedent that lets you to do whatever the fuck you want with a US flag that you own. You can trample on it all day long, and it’s a protected activity under the first amendment.

Edit: https://en.m.wikipedia.org/wiki/United_States_v._Eichman

Re:Country Flags in SVG by vbezhenar on Friday February 04, 2022 @09:32AM (#30207172)
My main issue is wrong ornament and it looks like very quickly put up work, e.g. sun rays are misaligned, eagle's head looks like a child paint. I'm not offended by it, but that's a bad quality and lack of attention to details and for some people that could be a source of offence when it comes to their national symbols. I admit that Kazakhstan's flag is quite complex compared to something like 3 colored rectangles, so it's hard to ask for more. But wikipedia's SVG should just be sourced and resized as necessary IMO rather than spending time re-painting it again. Probably the same with some other countries. I don't want to blame someone who took his time re-drawing those flags, that's respectable by itself. But there's some space for improvement. May be I should make a pull request rather than whining about it.
Re:Country Flags in SVG by HelloNurse on Friday February 04, 2022 @10:21AM (#30207860)
A handmade eagle made with cloth, scissors and embroidery for an actual flag can be far worse than a badly drawn icon.
Re:Country Flags in SVG by abujazar on Friday February 04, 2022 @07:03AM (#30205727)
Most of these flags seem to have wrong proportions, a lot of those I checked also have wrong colors and some of the flags have other serious mistakes. So unfortunately this library seems quite useless.
Re:Country Flags in SVG by sdflhasjd on Friday February 04, 2022 @07:10AM (#30205785)
They'd be ok for small icons where the details are indistinguishable
Re:Country Flags in SVG by yorwba on Friday February 04, 2022 @07:57AM (#30206210)
Only if you're fine with them being indistinguishable.

The flags of Indonesia and Monaco are easy to tell apart if they're the correct aspect ratio, because the flag of Monaco is much narrower. If you force both of them into the same shape, as this collection does

https://flagicons.lipis.dev/flags/4x3/id.svg

https://flagicons.lipis.dev/flags/4x3/mc.svg

they only differ in the shade of red. And I think they got it wrong: Indonesia's red looks darker than I'm used to, Monaco's looks brighter.

If you absolutely need to fit many different flags into a uniform rectangle, you'd better keep the aspect ratio and leave the rest of the rectangle transparent. And don't forget to include a differently-colored border so people can tell where white stripes end (or whatever your background color is.)

Re:Country Flags in SVG by m-p-3 on Friday February 04, 2022 @05:29PM (#30214275)
At this point I'd just rely on the emoji font of the system..
Re:Country Flags in SVG by chrisseaton on Friday February 04, 2022 @06:49AM (#30205618)
Note that flags have official ratios - they're aren't just a generic shape.
Re:Country Flags in SVG by smoe on Friday February 04, 2022 @07:39AM (#30206030)
Also official colors. Some of the flags have both wrong.
Re:Country Flags in SVG by yonixw on Friday February 04, 2022 @06:56AM (#30205670)
Neh, pal.
Re:Country Flags in SVG by eyeundersand on Friday February 04, 2022 @08:12AM (#30206358)
Ha! I'm from there and it's always interesting to see the flag get butchered in a variety of ways across the internet and in real life. The procedure for drawing the flag is outlined in the constitution and there's a popular numberphile video on it (https://www.youtube.com/watch?v=f2Gne3UHKHs).

Last I checked, there's some ambiguity in how to draw the moon in the upper triangle. It's supposed to have eight points with no prescription on how they connect to the crescent below. (Step 18 in this tutorial: https://www.settinger.net/experiments/nepal-flag/). This seems to be the most popular version: https://clipground.com/images/nepali-flag-png-4.png.

Re:Country Flags in SVG by chrisseaton on Friday February 04, 2022 @06:58AM (#30205695)
For example the Union Flag is normally 1:2, while the Stars and Stripes is 1:1.9
Re:Country Flags in SVG by s_dev on Friday February 04, 2022 @07:04AM (#30205736)
I think he's saying 'Nepal'. Which has a triangular flag.
Re:Country Flags in SVG by chrisseaton on Friday February 04, 2022 @07:11AM (#30205797)
Never seen Nepal written like that before.
Re:Country Flags in SVG by bananicorn on Friday February 04, 2022 @07:32AM (#30205961)
That was probably supposed to be a pun - you're both on the same side here :)
Re:Country Flags in SVG by tyingq on Friday February 04, 2022 @07:03AM (#30205732)
You might have missed the subtle pointer to Nepal's flag.
Re:Country Flags in SVG by blue1 on Friday February 04, 2022 @06:46AM (#30205591)
Except that flags do not all have the same ratio. It may be useful to assume so for graphic layouts, but it is not really correct.
Re:Country Flags in SVG by fredoralive on Friday February 04, 2022 @06:59AM (#30205704)
The 1:1 variants seem to indicate that this collection is intended more for the benefit of UI designers etc. who want all flags to have consistent shape for their designs rather than as a reference for the definitive versions of flags.

Unfortunately they chose 3:4 for the rectangular variants, which isn't really used that much, 2:3 and 1:2 are more common for flags[1], so lots more flags have their designs rearranged, squished and stretched to fit the box than would otherwise need to be. For example flags with the UK's Union Jack in the canton seem to be noticeably mangled as the Union Jack seems far too large relatively. It's always going to be a compromise to have one shape, but just using 2:3 (the most common shape) would mean far fewer would need adjustments.

[1] https://en.wikipedia.org/wiki/List_of_aspect_ratios_of_natio...

Re:Country Flags in SVG by gspr on Friday February 04, 2022 @07:17AM (#30205828)
> The 1:1 variants seem to indicate that this collection is intended more for the benefit of UI designers etc. who want all flags to have consistent shape for their designs rather than as a reference for the definitive versions of flags.

So the UI people just make up fake flags then. Cool.

Re:Country Flags in SVG by bloak on Friday February 04, 2022 @06:56AM (#30205671)
And a fun thing about the UK flag is that you are allowed to make it in different aspect ratios, but you can't just naively scale it: https://en.wikipedia.org/wiki/Union_Jack#Specification

I don't know whether SVG can handle that, but you can get JavaScript to display it correctly in any aspect ratio, of course.

Re:Country Flags in SVG by chrismorgan on Friday February 04, 2022 @09:25AM (#30207079)
https://temp.chrismorgan.info/2022-02-05-union-jack.svg

It depends on calc(), vw and vh units, so it’ll work in browsers but not elsewhere.

(Certainly not all flags with similar specifications will be achievable; this one’s diagonals just happened to be all neatly anchored in the corners, though the red diagonal St Patrick’s cross is fiddly, requiring masking to achieve the required stroke alignment, for which see also https://svgwg.org/specs/strokes/#SpecifyingStrokeAlignment, which is an incomplete draft, and unimplemented.)

Re:Country Flags in SVG by dveeden2 on Friday February 04, 2022 @06:39AM (#30205532)
Seems like this is suffering from issues around the flag of Afghanistan as well: https://blog.emojipedia.org/what-about-the-afghanistan-flag-...
Re:Country Flags in SVG by mnsc on Friday February 04, 2022 @06:47AM (#30205594)
A simple "technical" project that solves a clearly defined issue (a collection of the flags of the world for easy use) but turns out to be a lightning rod for political drama.
Re:Country Flags in SVG by macintux on Friday February 04, 2022 @07:06AM (#30205749)
First thing I did: scroll to see whether Taiwan was represented.
Re:Country Flags in SVG by iqanq on Friday February 04, 2022 @06:55AM (#30205659)
Re:Country Flags in SVG by iqanq on Friday February 04, 2022 @06:55AM (#30205657)
Exactly what I was thinking - the flag of Afghanistan is not current.
Re:Country Flags in SVG by danielskogly on Friday February 04, 2022 @07:02AM (#30205719)
Wikipedia's "Gallery of sovereign state flags"[0] is also a good source for SVGs of flags.

[0]: https://en.wikipedia.org/wiki/Gallery_of_sovereign_state_fla...

Re:Country Flags in SVG by nemetroid on Friday February 04, 2022 @07:47AM (#30206129)
On my iPhone, some of the cross flags have gaps in them (e.g. Georgia, Guernsey and Sweden), see image below. But when I view the source for the Swedish flag, it's very clearly drawing one blue rectangle and two yellow ones:

  <svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-se" viewBox="0 0 640 480">
    <path fill="#066aa7" d="M0 0h640v480H0z"/>
    <path fill="#fecc00" d="M0 192h640v96H0z"/>
    <path fill="#fecc00" d="M176 0h96v480h-96z"/>
  </svg>
(each path has five commands, making a box: "move to", "horizontal line", "vertical line", "horizontal line", "close path")

I guess the iOS SVG renderer is just buggy.

https://i.imgur.com/toS0Wjh.jpeg

https://github.com/lipis/flag-icons/blob/main/flags/4x3/se.s...

Re:Country Flags in SVG by dveeden2 on Friday February 04, 2022 @06:43AM (#30205560)
Looks like the French flag has missed an update: https://www.euronews.com/2021/11/15/macron-reverts-french-fl...
Re:Country Flags in SVG by inshadows on Friday February 04, 2022 @11:39AM (#30209076)
Who else immediately thought Red Dwarf's scene where Rimmer commanded bots to repaint the interior from navy blue to ocean blue?
Re:Country Flags in SVG by aseure on Friday February 04, 2022 @08:00AM (#30206243)
Reminds me of the challenge that a former colleague of mine threw to himself to make all country flags in pure CSS [1].

[1] https://pixelastic.github.io/css-flags/

Re:Country Flags in SVG by rbut on Friday February 04, 2022 @07:21AM (#30205855)
Or you could generate the emoji symbol for the flag you want to display:

  country_code = 'AU'
  c1, c2 = map(lambda x: ord(x) + 0x1f1a5, country_code)
  flag = chr(c1) + chr(c2)
Re:Country Flags in SVG by TonyTrapp on Friday February 04, 2022 @07:25AM (#30205899)
Which assumes that the user has a font installed containing all required emojis. It's much safer to assume that their browser can render SVGs.
Re:Country Flags in SVG by rbut on Friday February 04, 2022 @07:31AM (#30205952)
Which is pretty much every current OS and device except Windows, but yes. Microsoft holding us back again.
Re:Country Flags in SVG by julianwachholz on Friday February 04, 2022 @09:28AM (#30207117)
I still assume political reasons and it's a lose lose situation for MS. E.g. they either include Taiwan's flag and lose China's approval, or they don't and get a huge backlash from everywhere else.

PS: Firefox on Windows uses its own emoji font "Twemoji Mozilla" to display flags.

Re:Country Flags in SVG by otrahuevada on Friday February 04, 2022 @08:27AM (#30206489)
No font in Google fonts does, for instance. At least from their own little demonstrator. There is https://github.com/googlefonts/noto-emoji Noto Emoji which can render the flags but you need to build it yourself
Re:Country Flags in SVG by warning26 on Friday February 04, 2022 @11:19AM (#30208790)
These are all super ugly -- if you want good SVG flags with a permissive license, I highly recommend using the SVGs from Noto Color Emoji:

https://github.com/googlefonts/noto-emoji/tree/main/svg

Re:Country Flags in SVG by julianwachholz on Friday February 04, 2022 @10:20AM (#30207850)
This is a really good project if you want to anger every vexillologist and people who like their country's flag.
Re:Country Flags in SVG by Fileformat on Friday February 04, 2022 @12:44PM (#30210029)
Shameless plug: My side project for searching for logos includes Lipis flags as well as some other sources.

Search index is on the file name, so it only really works well for distinct country codes: https://logosear.ch/search.html?q=bz

But the exact match pages will work: https://logosear.ch/logos/pl/index.html

Re:Country Flags in SVG by heipei on Friday February 04, 2022 @07:11AM (#30205791)
Anyone know of a similar library but with low-poly / low-res SVG/PNG flags instead? These flags are great, but they're also huge (some bigger than 400kB), which isn't really necessary if you're only showing them as small icons no larger than 10-20px.
Re:Country Flags in SVG by Someone on Friday February 04, 2022 @07:22AM (#30205862)
Find an opensource font that supports Unicode Regional Indicator Symbols (https://en.wikipedia.org/wiki/Regional_indicator_symbol).

Google led me to https://www.babelstone.co.uk/Fonts/Flags.html. That’s SIL-licensed.

There almost certainly are other fonts with liberal licenses.

Re:Country Flags in SVG by unixbane on Friday February 04, 2022 @11:17AM (#30208756)
They look terrible (as SVG is not something that is good for aesthetics) and are ironic beccause they insult the nationalism of each country. Well, maybe I'm thinking of coat of arms in SVG.
Re:Country Flags in SVG by rommel917 on Friday February 04, 2022 @08:05AM (#30206295)
Sweden 228B, Croatia 41.5kB. And kids in first year of school should know how to draw flag from memory :(. SVG file size should be good indicator to see if flag is to complex.
Re:Country Flags in SVG by misterS on Friday February 04, 2022 @08:15AM (#30206395)
> kids in first year of school should know how to draw flag from memory

Roman Mars taught me that – well Ted Kaye, but Roman taught me in his seminal TED talk [1].

[1] https://www.youtube.com/watch?v=pnv5iKB2hl4

Re:Country Flags in SVG by rommel917 on Friday February 04, 2022 @09:35AM (#30207218)
I sorted all svg files by size to find most complex and least complex, it looks like good indicator but not to be used alone.

3 worst

-rw-r--r-- 1 197121 395610 Feb 4 15:19 do.svg Dominican Republic

-rw-r--r-- 1 197121 187525 Feb 4 15:19 rs.svg Serbia

-rw-r--r-- 1 197121 118305 Feb 4 15:19 bo.svg Bolivia

3 best

-rw-r--r-- 1 197121 225 Feb 4 15:19 pl.svg Poland

-rw-r--r-- 1 197121 215 Feb 4 15:19 de.svg Deutschland

-rw-r--r-- 1 197121 191 Feb 4 15:19 bd.svg Bangladesh

Re:Country Flags in SVG by xjay on Friday February 04, 2022 @07:11AM (#30205798)
Maybe we should just paint the country code on a white piece of cloth instead.
Re:Country Flags in SVG by riidom on Friday February 04, 2022 @01:22PM (#30210805)
Also, flags on websites shouldn't be used for language switchers.
Re:Country Flags in SVG by bradhe on Friday February 04, 2022 @07:29AM (#30205933)
No flag for Palestine?
Re:Country Flags in SVG by jan_Inkepa on Friday February 04, 2022 @07:34AM (#30205982)
Yes there is. (The list is only kind-of in alphabetical order).