Skip to content

yaroslavzghoba/material-color-utilities-kotlin

Repository files navigation

Material Color Utilities for Kotlin 🎨

Kotlin version Maven Central release License

Material Color Utilities for Kotlin is a cross-platform wrapper written entirely in Kotlin around Google's Material Color Utilities (MCU), making it easy to generate beautiful, accessible, and user-driven color schemes (including Material 3) using advanced color algorithms.


🚀 Getting Started

  1. Add the library dependency to your build.gradle.kts file:
dependencies {
    implementation("space.zghoba:material-color-utilities-kotlin:2.1.0")
}
  1. Add a simple example of using the HCT color model. When using HCT, only the hue changes. The tone and chroma remain constant, so colors appear equally bright regardless of their hue.
import hct.Hct

fun main() {
    // Same perceived brightness.
    // Different hue.
    val red   = Hct.from(hue = 20.0, 80.0, 60.0).toInt()
    val green = Hct.from(hue = 140.0, 80.0, 60.0).toInt()
    val blue  = Hct.from(hue = 260.0, 80.0, 60.0).toInt()
}

Note

The HCT color model isn't the only feature offered by the Material Color Utilities repository. See Capabilities Overview for more information.


📄 License

This project is licensed under the MIT License — see the LICENSE file.

About

A cross-platform Kotlin wrapper around Material Color Utilities (MCU), making dynamic theming.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages