-
-
Notifications
You must be signed in to change notification settings - Fork 310
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Per waldyrious's suggestion on #8, here are some experiments with converting flags to use a circular <clipPath>. This helps to avoid having longer than necessary <path d="...">s, and generally makes the code more human readable. It also seems to result in smaller files when minified with svgo (For these examples I'm using svgo 1.3.2; the latest release at the time of writing).
We also trying to avoid the anti-aliasing/color-bleeding issues described here and on the graphic design SE.
Russia
Original (302 bytes minified):
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<circle cx="256" cy="256" r="256" fill="#eee"/>
<path fill="#0052b4" d="M496 345a255.4 255.4 0 0 0 0-178H16a255.5 255.5 0 0 0 0 178l240 22.3L496 345z"/>
<path fill="#d80027" d="M256 512a256 256 0 0 0 240-167H16a256 256 0 0 0 240 167z"/>
</svg>New (298 bytes minified):
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<defs>
<clipPath id="circle-mask">
<circle r="256" cy="256" cx="256"/>
</clipPath>
</defs>
<g clip-path="url(#circle-mask)">
<rect y="0" x="0" height="160" width="512" fill="#eeeeee"/> <!-- white -->
<rect y="160" x="0" height="192" width="512" fill="#0052b4"/> <!-- blue -->
<rect y="352" x="0" height="160" width="512" fill="#d80027"/> <!-- red -->
</g>
</svg>
United States
Original (836 bytes minified):

16px, 24px, 32px, 48px (zoomed to 400%)
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<circle cx="256" cy="256" r="256" fill="#eee"/>
<path fill="#d80027" d="M246 55v67h227.9A256 256 0 0 0 414 55H246zm0 134v67h266a256 256 0 0 0-9-67H246zM9 323a256 256 0 0 0 29.1 67h435.7a256 256 0 0 0 29-67H9zm89 134a256 256 0 0 0 158 55 256 256 0 0 0 158.5-55H97.9z"/>
<path fill="#0052b4" d="M256 0a256 256 0 0 0-135 38.9h20l-21.6 15.7 8.2 25.4L106 64.3 84.4 80l6.3-19.4a256 256 0 0 0-48 54.3H48L38 122a256 256 0 0 0-9.2 16.1l5.8 17.8-10.5-7.7a256 256 0 0 0-9.3 22.7l6.5 19.9H48l-21.6 15.7 8.2 25.4L13 216.3 2.2 224A256 256 0 0 0 0 256h256V0z"/>
<path fill="#eee" d="M84.4 156l56.6-41.1H71l56.6 41.1L106 89.4zm93 0l56.6-41.1h-70l56.6 41.1L199 89.4zm0-76L234 38.9h-70L220.6 80 199 13.4zm-93 152l56.6-41.1H71l56.6 41.1-21.6-66.6zm93 0l56.6-41.1h-70l56.6 41.1-21.6-66.6z"/>
</svg>New (784 bytes minified):

16px, 24px, 32px, 48px (zoomed to 400%)
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<defs>
<clipPath id="circle-mask">
<circle r="256" cy="256" cx="256"/>
</clipPath>
<path id="star" d="M-8.6 80L48 38.9h-70L34.6 80 13 13.4z" fill="#eeeeee"/>
</defs>
<g clip-path="url(#circle-mask)">
<rect y="0" x="0" height="512" width="512" fill="#eeeeee"/> <!-- White background -->
<g fill="#d80027"> <!-- Red stripes -->
<rect y="64" x="0" height="64" width="512"/>
<rect y="192" x="0" height="64" width="512"/>
<rect y="320" x="0" height="64" width="512"/>
<rect y="448" x="0" height="64" width="512"/>
</g>
<rect y="0" x="0" height="256" width="256" fill="#0052b4"/> <!-- Blue background -->
<use href="#star" transform="translate(0 0)"/>
<use href="#star" transform="translate(0 76)"/>
<use href="#star" transform="translate(0 152)"/>
<use href="#star" transform="translate(93 0)"/>
<use href="#star" transform="translate(93 76)"/>
<use href="#star" transform="translate(93 152)"/>
<use href="#star" transform="translate(186 0)"/>
<use href="#star" transform="translate(186 76)"/>
<use href="#star" transform="translate(186 152)"/>
</g>
</svg>waldyrious and tnovau
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request