Closed plt005 closed 2 years ago
The same colour problem appears to affect the flag of Latvia. This is correct upstream in emojione-color https://github.com/eosrei/emojione-color-font/blob/master/assets/emojione-svg/1f1f1-1f1fb.svg but has been oddly transposed here.
I've had a closer look at the upstream svg. Both the Latvian and Qatari flags appear to have a semi-transparent overlay over the coloured portions of their flags. There are three paths in each SVG, one with a coloured portion (both #c94747), then another with a fractional opacity which adjusts the colour, then a white/grey path. I guess that the SVG/cairo conversion doesn't do the blending well, or the same way other implementations do, and we get weird colours here. I am going to try adjusting the svg and importing and building to see if that fixes this glitch.
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" enable-background="new 0 0 64 64"><path d="m61.2 39v-14c-3.2-13.2-15-23-29.2-23s-26 9.8-29.2 23v14c3.2 13.2 15 23 29.2 23s26-9.8 29.2-23" fill="#c94747"/><path d="m61.2 39v-14c-3.2-13.2-15-23-29.2-23s-26 9.8-29.2 23v14c3.2 13.2 15 23 29.2 23s26-9.8 29.2-23" opacity=".15" fill="#c28fef"/><path d="m2 32c0 2.4.3 4.8.8 7h58.3c.5-2.2.8-4.6.8-7 0-2.4-.3-4.8-.8-7h-58.3c-.5 2.2-.8 4.6-.8 7" fill="#fff"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64" enable-background="new 0 0 64 64"><path d="m32 2c-5.3 0-10.2 1.4-14.5 3.7v52.5c4.3 2.4 9.2 3.8 14.5 3.8 16.6 0 30-13.4 30-30s-13.4-30-30-30" fill="#c94747"/><path d="m32 2c-5.3 0-10.2 1.4-14.5 3.7v52.5c4.3 2.4 9.2 3.8 14.5 3.8 16.6 0 30-13.4 30-30s-13.4-30-30-30" opacity=".33" fill="#9450e0"/><path d="m2 32c0 11.3 6.3 21.1 15.5 26.3l10.5-2.3-10-3 10-3-10-3 10-3-10-3 10-3-10-3 10-3-10-3 10-3-10-3 10-3-10-3 10-3-10-3 10-3-10.5-2.3c-9.2 5.2-15.5 15-15.5 26.3" fill="#f9f9f9"/></svg>
Thanks very much for taking such a detailed look at this, @RichardMN! I suspect you're right.
As you can probably tell, I haven't been able to make big changes to ggflags
recently—I've had some trouble rebuilding with its dependencies (and I suspect the state of the art with the SVG stack has evolved a bit since I put the last release together, particularly in light of the work that's upcoming in R 4.1).
Nevertheless, if we can fix existing problems and allow current users to keep using ggflags
, that's fantastic. If you gave success building with this fix, please submit a PR and I'll merge it!
I have done some fiddling and figured out a bit of what may make the problem and I have a fix which works on some of my code but not others.
I determined which data in the rda was problematic and how to address it and fix it. This is shown in my branch but I honestly haven't even been able to get this to run in my code running against the rensa master.
Another day I will try getting a clean environment and then I think that the following two lines, after loading the ggflags package, should make the necessary change in the data.
Suggestions on how to better adjust this would be welcome. I thought I had re-saved the rda but now have something which breaks on loading.
# 15% opacity gives 2B in the alpha channel
.flaglist[["lv"]]@content[[1]]@content[[2]]@content[[1]]@gp$fill <- "#C28FEF2B"
# 33% opacity gives 54 in the alpha channel
.flaglist[["qa"]]@content[[1]]@content[[2]]@content[[1]]@gp$fill <- "#9450E054"
See https://en.wikipedia.org/wiki/Flag_of_Qatar