Skip to content

Build your personal knowledge base with Trilium Notes

feat(mobile): provide monochrome icon too

Elian Doran07608a041b94
diff --git a/apps/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/apps/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
index 036d09bc5f..4df90c3c1e 100644
--- a/apps/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+++ b/apps/mobile/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="@mipmap/ic_launcher_foreground"/>
+ <monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>
</adaptive-icon>
\ No newline at end of file
diff --git a/apps/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/apps/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
index 036d09bc5f..4df90c3c1e 100644
--- a/apps/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
+++ b/apps/mobile/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.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="@mipmap/ic_launcher_foreground"/>
+ <monochrome android:drawable="@mipmap/ic_launcher_monochrome"/>
</adaptive-icon>
\ No newline at end of file
diff --git a/apps/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png b/apps/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png
new file mode 100644
index 0000000000..31cc9f0e33
Binary files /dev/null and b/apps/mobile/android/app/src/main/res/mipmap-hdpi/ic_launcher_monochrome.png differ
diff --git a/apps/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png b/apps/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png
new file mode 100644
index 0000000000..3174e67abd
Binary files /dev/null and b/apps/mobile/android/app/src/main/res/mipmap-mdpi/ic_launcher_monochrome.png differ
diff --git a/apps/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png b/apps/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png
new file mode 100644
index 0000000000..a0ac6d4298
Binary files /dev/null and b/apps/mobile/android/app/src/main/res/mipmap-xhdpi/ic_launcher_monochrome.png differ
diff --git a/apps/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png b/apps/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png
new file mode 100644
index 0000000000..af3c1338ed
Binary files /dev/null and b/apps/mobile/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_monochrome.png differ
diff --git a/apps/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png b/apps/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png
new file mode 100644
index 0000000000..f8998ba56a
Binary files /dev/null and b/apps/mobile/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_monochrome.png differ
diff --git a/scripts/icons/create-icons.sh b/scripts/icons/create-icons.sh
index c02cd88bd3..ae320b2abd 100644
--- a/scripts/icons/create-icons.sh
+++ b/scripts/icons/create-icons.sh
@@ -111,6 +111,13 @@ for density in mdpi hdpi xhdpi xxhdpi xxxhdpi; do
-extent ${foreground_size}x${foreground_size} "$mipmap_dir/ic_launcher_foreground.png"
rm "$mipmap_dir/_tmp_fg.png"
+ # Monochrome layer for Android 13+ themed icons. Android ignores RGB and
+ # uses only the alpha channel, tinting it with the system theme color.
+ inkscape -w $fg_logo -h $fg_logo "$source_icon_dir/icon-black.svg" -o "$mipmap_dir/_tmp_mono.png"
+ magick "$mipmap_dir/_tmp_mono.png" -background none -gravity center \
+ -extent ${foreground_size}x${foreground_size} "$mipmap_dir/ic_launcher_monochrome.png"
+ rm "$mipmap_dir/_tmp_mono.png"
+
# Legacy square launcher (logo on solid background)
sq_logo=$(( launcher_size * 2 / 3 ))
inkscape -w $sq_logo -h $sq_logo "$source_icon_dir/icon-color.svg" -o "$mipmap_dir/_tmp.png"