Search code examples
androidsvgandroid-launcherandroid-iconsadaptive-icon

Adaptive Icon shapes path


This is how Launcher3 defines icon shape path.

<string-array translatable="false" name="icon_shape_override_paths_values">
    <item>M50,0L100,0 100,100 0,100 0,0z</item>
    <item>M50,0 C10,0 0,10 0,50 0,90 10,100 50,100 90,100 100,90 100,50 100,10 90,0 50,0 Z</item>
    <item>M50 0A50 50,0,1,1,50 100A50 50,0,1,1,50 0</item>
    <item>M50,0A50,50,0,0 1 100,50 L100,85 A15,15,0,0 1 85,100 L50,100 A50,50,0,0 1 50,0z</item>
</string-array>

These correspond to square, squircle, circle and teardrop accordingly.

Now I wonder how can I create my own shape like this. I want to draw a hexagon.


Solution

  • Try something like:

    <item>M 50,0 L 100,25, 100,75, 50,100, 0,75, 0,25 Z</item>
    

    Example:

    svg {
      background: linen;
    }
    <svg width="100" height="100">
      <path d="M 50,0 L 100,25, 100,75, 50,100, 0,75, 0,25 Z"/>
    </svg>