Flag colors

I made another dumb thing. Here’s a collection of flag colors. Do you think something like this would be useful to you? Is this a reasonable way to use it, or should it hook in to some other Colors functionality?

Example flag colors


In my opinion ColorSchemes would be the perfect place.

1 Like

I wasn’t going to, but then it was that or go to bed so it’s in there now.


Seems nice. I’m a little surprised by the rendering, though… Nordic countries such as Finland, Denmark, and Sweden have a background color (white, red, blue, respectively), and a cross with a smaller area and with another color (blue, white, yellow, respectively). The Finnish flag scheme is dominated by blue (which covers a minor part of the flag), the Danish flag scheme has very little white (admittedly the colors that covers the smallest part of the area), while the Swedish flag scheme is almost as much dominated by the minority color as the Finnish flag – and looks somewhat strange in that a large fraction of the Swedish scheme appears as green – a color that is not in the flag.

Anyway, I’m curious as to how you made the schemes :-).

1 Like

I made a counscious decision to automate the process as much as possible, to avoid both work and diplomatic liability.

The current colorschemes in Colorschemes were generated as follows:

  1. For each flag code, the svg flag is opened
  2. If there are any g tags containing a fill or stroke specification, those colors are added to a color list
  3. If there is any css fill: or stroke: specification, those colors are added
  4. If there are any stop-color specifications, those colors are added (this is for gradients, which are otherwise very difficult to handle)
  5. If there are any path, circle or rect tags without a color specification, and no colors were added in points 2 – 4, black is added (for some reason svg will default to black if no color is inherited
  6. All color specifications from path, circle or rect tags are added
  7. The list is uniqued

All this is to say, there might be a black or white extra or missing in some flags, but that is because they have a complicated flag with a weird svg file. Also, colors appear (roughly) in the order they do in the file, which doesn’t necessarily correspond to their order or abundance on the flag.

The picture above is the cgrad of the scheme, basically the colors it takes if you go continuously from one end to the other. The link above displays the normal color scheme better, and there the Nordic flags make more sense.There is still no order or abundance information though. It was either do it like this or edit over 300 flags manually.


Nice idea. Still, it is complicated to make it so that people are happy when you attach the “flag” label to it: I’d guess that, e.g., Swedes, may find it strange with a green color in the mixture. But that is perhaps unavoidable when using cgrad(). I’m don’t have any ideas to fix the color mixing problem :open_mouth:

I’m Swedish incidentally.

The solution is simple, only use these as discrete color schemes.


Just throwing in ideas. If you would use a raster image, you could make a histogram of the colors and use this for colormap creation.

1 Like