Skip to content

walter-juan/compose-icon-collections

Repository files navigation

Compose icon collections

Compose Multiplatform open source icon collections. Available platforms: Android, iOS, Desktop (JVM), Web (Wasm)

Platform MIT License

As Seen In - jetc.dev Newsletter Issue #237

Android iOS Desktop Web

How to use it

Available in Maven Central

repositories {
    mavenCentral()
}

Add it to your project, see the table below for the corresponding version.

kotlin {
   sourceSets {
      commonMain {
         dependencies {
            implementation("com.woowla.compose.icon.collections:{artifact}:{version}")
         }
      }
   }
}

In your code, use the icons like this:

Icon(imageVector = Octicons.Home16, contentDescription = null)
Icon(imageVector = Tabler.Filled.HospitalCircle, contentDescription = null)
Icon(imageVector = Tabler.Outline.HospitalCircle, contentDescription = null)

Icon packs

See all available icons on the GitHub Pages, only the latest published version is available.

The same version numbers as the official icon packs have been followed

Icon Pack Artifact Version License
Tabler tabler Tabler - Maven Central Version GitHub License
Octicons octicons Octicons - Maven Central Version GitHub License
Remix Icon remix Remix - Maven Central Version GitHub License
Boxicons boxicons Boxicons - Maven Central Version GitHub License
Feather feather Feather - Maven Central Version GitHub License
Ionicons ionicons Ionicons - Maven Central Version GitHub License
Font Awesome fontawesome Font Awesome - Maven Central Version Static Badge
Heroicons heroicons Heroicons - Maven Central Version GitHub License
Simple icons simpleicons Simple icons - Maven Central Version GitHub License
Bootstrap icons twbs Bootstrap icons - Maven Central Version GitHub License

How it works

Download task

Download tasks are executed to update the icons, the process is as follows:

  1. The icons are downloaded from the official repositories
  2. The SVG files are converted to Compose using SVG to compose and saved in the corresponding module
  3. Documentation is generated and saved in the docs folder
  4. The version is updated in the build.gradle file
  5. (Optional) The changes are committed to the repository

Auto update

The Update icons workflow will update the icons automatically every 2 weeks. Right now, it only updates icons that have GitHub releases, so there are some icons that should be updated manually

Special cases

Typically, all icon download tasks retrieve icons from GitHub releases. However, there are a few exceptions:

  • boxicons: Downloads icons directly from the main branch for this reason this is not updated automatically, a manual update required.
  • ionicons: Uses a custom afterDownload and gitHubUrlProvider function to categorize icons. Additionally, there is an issue with the Square value from StrokeCap in the generated image vectors. This must be manually replaced with StrokeCap.Square to avoid conflicts with an icon named Square.
  • fontawesome: Implements a custom iconNameTransformer to handle conflicts between the FontAwesome icon and its accessor name.
  • simpleicons: Uses a custom afterDownload function to remove the lerna.svg icon because it throws MethodTooLargeException when compiling the project.

Development

Requirements

Update the icons

  • Icon pack using GitHub releases: Run the icon download task, use the -Pgitcommit flag to commit the changes.
  • Icon pack using the main branch: Run the icon download task, manually update the version in the build.gradle file, and commit the changes.

Add new icons

  1. Add new module
    • Create a new module by copying the build.gradle from an existing module. Copy octicons if the icon pack uses GitHub releases or boxicons if it uses the main branch.
    • Update everything needed like the version, download-icons task, and others from the build.gradle
  2. Update workflows
  3. Update readme
    • Add a new entry in the Icon packs section
    • If a special case has been added, add a note in the Special cases section

Test icons

Right now the only way to test is by running the sample app, follow these steps:

  1. Replace the icons dependency you would like to test in build.gradle.kts file
  2. Add AllIcons to the icons list in the App.kt file
  3. Run the sample app and check the icons

Gradle tasks

  • The folder .run contains all the necessary tasks to download the icons and run the sample apps (Android/iOS/Desktop/Web)
  • Download icons tasks with update docs and version:
    • ./gradlew <module>:download-icons
    • ./gradlew <module>:download-icons -Pgitcommit use the -Pgitcommit flag to commit the changes
    • ./gradlew download-icons to download all the icons, just in case do not use with the -Pgitcommit flag

GitHub actions

  • Verification: Verify the icons, it must be run manually before merge a pull request
  • Deploy: Deploy the main branch to Maven Central
  • Update icons: Update the icons automatically, not all icons can be updated automatically

Useful links