All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.materialkolor.ktx.TonalPalette.kt Maven / Gradle / Ivy

Go to download

A Compose multiplatform library for generating dynamic Material3 color schemes from a seed color.

There is a newer version: 2.0.0
Show newest version
package com.materialkolor.ktx

import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import com.materialkolor.hct.Hct
import com.materialkolor.palettes.TonalPalette

/**
 * Generates a [TonalPalette] from the given [color].
 *
 * @param[color] The color to generate the [TonalPalette] from.
 * @return The generated [TonalPalette].
 */
public fun TonalPalette.Companion.from(color: Color): TonalPalette {
    return from(color.toArgb())
}

/**
 * Generates a [TonalPalette] from the given [argb] color int.
 *
 * @param[argb] The ARGB representation of a color to generate the [TonalPalette] from.
 * @return The generated [TonalPalette].
 */
public fun TonalPalette.Companion.from(argb: Int): TonalPalette {
    return fromInt(argb)
}

/**
 * Generates a [TonalPalette] from the given [Hct].
 *
 * @param[hct] The color to generate the [TonalPalette] from.
 * @return The generated [TonalPalette].
 */
public fun TonalPalette.Companion.from(hct: Hct): TonalPalette {
    return fromHct(hct)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy