This library allows you to generator icons for KMP projects.
It currently supports following:
- base on a source image:
- generate a common icon for compose resources
- generate a ico file for windows
the source can be the playstore icon generated by Android Studio e.g.
Using Version Catalogs
Define the dependencies inside your libs.versions.toml file.
[versions]
kmpicon = "<LATEST-VERSION>"
[plugins]
kmpicon-plugin = { id = "io.github.mflisar.kmpicon.plugin", version.ref = "kmpicon" }And then use the definitions in your projects build.gradle.kts file like following:
plugins {
id(libs.kmpicon.plugin)
}Direct Dependency Notation
Simply add the dependencies inside your build.gradle.kts file.
plugins {
id("io.github.mflisar.kmpicon.plugin") version "<LATEST-VERSION>"
}This library is used like following:
- generate a icon with
AndroidStudio - use this plugin to copy and/or create images for different use cases
Create a common main icon
kmpIcon {
setup {
sourceModule = "demo/app/android" // path of the android module where the source file is located (default: app/app/android")
sourceFile = "src/main/ic_launcher-playstore.png" // relative path to the source file (default: src/main/ic_launcher.png)
}
generateCommonIcon {
file = "src/commonMain/composeResources/drawable/icon.png" // relative path to the output file (default: src/commonMain/composeResources/drawable/icon.png)
}
}Create a ico for windows
kmpIcon {
setup {
sourceModule = "demo/app/android" // path of the android module where the source file is located (default: app/app/android")
sourceFile = "src/main/ic_launcher-playstore.png" // relative path to the source file (default: src/main/ic_launcher.png)
}
generateIco {
file = "icon.ico" // relative path to the output file (default: icon.ico)
}
}A full demo is included inside the demo module, it shows nearly every usage with working examples.
Check out the API documentation.
You can find more libraries (all multiplatform) of mine that all do work together nicely here.