~emersion/goguma-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
3 2

[PATCH] android: add monochrome icon

Juan Cruz Orioli <contact@juancruzorioli.com>
Details
Message ID
<20221227221403.24309-1-contact@juancruzorioli.com>
DKIM signature
missing
Download raw message
Patch: +19 -0
---
I copied ic_launcher_foreground.xml and replaced the pathData value with
the one from ic_stat_name.xml.

 .../res/drawable/ic_launcher_monochrome.xml    | 18 ++++++++++++++++++
 .../main/res/mipmap-anydpi-v26/ic_launcher.xml |  1 +
 2 files changed, 19 insertions(+)
 create mode 100644 android/app/src/main/res/drawable/ic_launcher_monochrome.xml

diff --git a/android/app/src/main/res/drawable/ic_launcher_monochrome.xml b/android/app/src/main/res/drawable/ic_launcher_monochrome.xml
new file mode 100644
index 0000000..d79635b
--- /dev/null
+++ b/android/app/src/main/res/drawable/ic_launcher_monochrome.xml
@@ -0,0 +1,18 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="108dp"
    android:height="108dp"
    android:viewportWidth="108"
    android:viewportHeight="108">
  <group android:scaleX="1.5354404"
      android:scaleY="1.5354404"
      android:translateX="32.4"
      android:translateY="32.4">
    <path
        android:pathData="M0.014,0C0.0093,9.3784 0.0047,18.7568 0,28.1352C1.8757,26.2596 3.7514,24.3839 5.627,22.5082L28.1352,22.5082L28.1352,0L0.014,0zM10.7787,4.6039L12.6581,4.6039L12.6581,7.7887L15.4771,7.7887L15.4771,4.6039L17.3566,4.6039L17.3566,7.7887L20.2277,7.7887L20.2277,9.6681L17.3566,9.6681L17.3566,12.4871L20.2277,12.4871L20.2277,14.3666L17.3566,14.3666L17.3566,17.5509L15.4771,17.5509L15.4771,14.3666L12.6581,14.3666L12.6581,17.5509L10.7787,17.5509L10.7787,14.3666L7.9075,14.3666L7.9075,12.4871L10.7787,12.4871L10.7787,9.6681L7.9075,9.6681L7.9075,7.7887L10.7787,7.7887L10.7787,4.6039zM12.6581,9.6681L12.6581,12.4871L15.4771,12.4871L15.4771,9.6681L12.6581,9.6681z"
        android:strokeLineJoin="miter"
        android:strokeWidth="0.3727919"
        android:fillColor="#3f51b5"
        android:strokeColor="#00000000"
        android:strokeLineCap="butt"/>
  </group>
</vector>
diff --git a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
index 7353dbd..1084c24 100644
--- a/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+++ b/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -2,4 +2,5 @@
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
    <background android:drawable="@color/ic_launcher_background"/>
    <foreground android:drawable="@drawable/ic_launcher_foreground"/>
    <monochrome android:drawable="@drawable/ic_launcher_monochrome"/>
</adaptive-icon>
\ No newline at end of file
-- 
2.39.0
Details
Message ID
<lUn-lQ8dSm2nPth0SEf7fngNsqzVWTF4zNWYhGeGYsOl170ZMEwSTqQkl0IRpxFQf9GEF7jH0fLRd__u4OAKrL3qpP1fZjy_lxA2o0TtqTw=@emersion.fr>
In-Reply-To
<20221227221403.24309-1-contact@juancruzorioli.com> (view parent)
DKIM signature
missing
Download raw message
Thanks for the patch!

On Tuesday, December 27th, 2022 at 23:14, Juan Cruz Orioli <contact@juancruzorioli.com> wrote:

> I copied ic_launcher_foreground.xml and replaced the pathData value with
> the one from ic_stat_name.xml.

Hm, I'm not sure this will work well. The size and position of the icon
in ic_stat_name.xml is different from the launcher icon.

Maybe a better approach is to start with the launcher icon and then
make it monochrome?
Juan Cruz Orioli <contact@juancruzorioli.com>
Details
Message ID
<2a71797d2e27b68b5ac52f55b4ee2fdc95be4a6e.camel@juancruzorioli.com>
In-Reply-To
<lUn-lQ8dSm2nPth0SEf7fngNsqzVWTF4zNWYhGeGYsOl170ZMEwSTqQkl0IRpxFQf9GEF7jH0fLRd__u4OAKrL3qpP1fZjy_lxA2o0TtqTw=@emersion.fr> (view parent)
DKIM signature
missing
Download raw message
On Wed, 2023-01-04 at 18:26 +0000, Simon Ser wrote:
> Maybe a better approach is to start with the launcher icon and then
> make it monochrome?

I tried this originally, but Android would merge both path elements
into one singular colour, effectively making the pound sign icon
invisible.

I imported the path data from the monochrome icon into a SVG
editor and it seems to be fine[1].

I searched but couldn't find another way to accomplish this with the
launcher icon. Let me know if you have any pointers and I'll be happy
to send another patch.

Cheers.

[1]: https://0x0.st/s/OaysM3JgQZpqlEhKs6hrhQ/o7MS.jpg
Details
Message ID
<NmFOAlnX9Z-yVgLLbgnOkO0hVA0NdWqe7jTM4s0vQrYcpplcApx_RNDQBKCj8Ap2MPQwie7c97Pabih0FYt1eicqm04wYUc98i843lyZqQs=@emersion.fr>
In-Reply-To
<2a71797d2e27b68b5ac52f55b4ee2fdc95be4a6e.camel@juancruzorioli.com> (view parent)
DKIM signature
missing
Download raw message
On Tuesday, January 10th, 2023 at 16:17, Juan Cruz Orioli <contact@juancruzorioli.com> wrote:

> On Wed, 2023-01-04 at 18:26 +0000, Simon Ser wrote:
> 
> > Maybe a better approach is to start with the launcher icon and then
> > make it monochrome?
> 
> I tried this originally, but Android would merge both path elements
> into one singular colour, effectively making the pound sign icon
> invisible.
> 
> I imported the path data from the monochrome icon into a SVG
> editor and it seems to be fine[1].
> 
> I searched but couldn't find another way to accomplish this with the
> launcher icon. Let me know if you have any pointers and I'll be happy
> to send another patch.

Sorry for the delay, took me a bit of time to have another look at this.

I had another look at this. I converted the regular icon to curve out
the hash sign outline in ic_launcher_foreground.xml, instead of drawing
it white. And then I realized that ic_stat_name uses the exact same
pathData, but wrapped in a <group> with a scaleX/scaleY to make it use
the correct size. So you were correct from the start: using this
pathData was fine to begin with.

I've updated the icons to all use the exact same pathData, and set the
monochrome icon to ic_launcher_foreground, since now that one is
monochrome too. :)

https://git.sr.ht/~emersion/goguma/commit/d68fcf404bcf8985486fcc1037ea7e48337c644c
Reply to thread Export thread (mbox)