Skip to content

Repository files navigation

IconTree Kotlin

IconTree Kotlin is a JVM-first Kotlin library for searching the IconTree API, downloading Lottie JSON, recoloring animations, and rendering them with Compose Multiplatform.

Modules

  • 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.

Requirements

  • JDK 17
  • Gradle 9.2.1 (provided by the included wrapper)

Build and test

Windows:

.\gradlew.bat build --no-daemon

macOS or Linux:

./gradlew build --no-daemon

The command compiles both modules and runs all JVM tests.

Core client

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.

Compose UI

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.

Configuration

val icons = IconTree(
    IconTreeConfig(
        baseUrl = "https://icontree.cosmoscope.workers.dev",
        maxRecoloredEntries = 256,
    ),
)

AI integrations

See AI_USAGE.md for the integration contract, safe calling patterns, and code-generation guidance for AI agents.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages