IconTree Kotlin is a JVM-first Kotlin library for searching the IconTree API, downloading Lottie JSON, recoloring animations, and rendering them with Compose Multiplatform.
icon-tree-core: HTTP client, models, color parsing, Lottie recoloring, and the local icon registry.icon-tree-compose: Compose UI that loads and renders an IconTree animation.
- JDK 17
- Gradle 9.2.1 (provided by the included wrapper)
Windows:
.\gradlew.bat build --no-daemonmacOS or Linux:
./gradlew build --no-daemonThe command compiles both modules and runs all JVM tests.
After publishing icon-tree-core to your Maven repository:
dependencies {
implementation("dev.cosmoscope.icontree:icon-tree-core:1.0.0")
}val icons = IconTree()
try {
val results = icons.search("heart").getOrThrow()
val heart = icons.fetchRecoloredIcon("heart", "#ff0066").getOrThrow()
println(results.iconIds)
println(heart.animation)
} finally {
icons.close()
}Network-facing APIs return Result<T>. Handle errors through exceptionOrNull() or use getOrThrow() when a failure should stop the calling flow.
After publishing icon-tree-compose to your Maven repository:
dependencies {
implementation("dev.cosmoscope.icontree:icon-tree-compose:1.0.0")
}Icon(
id = "heart",
size = 48.dp,
color = "#ff0066",
mode = IconMode.LOOP,
)Supported modes are STATIC, LOOP, ON_CLICK, and HOVER. The composable obtains the animation through IconTree, recolors it in memory, and renders it with Compottie.
val icons = IconTree(
IconTreeConfig(
baseUrl = "https://icontree.cosmoscope.workers.dev",
maxRecoloredEntries = 256,
),
)See AI_USAGE.md for the integration contract, safe calling patterns, and code-generation guidance for AI agents.