Package-level declarations

Types

Link copied to clipboard

Define the threshold for a contrast ratio.

Properties

Link copied to clipboard

Get the Color used to generate the DynamicScheme.

Functions

Link copied to clipboard
fun Color.blend(to: Color, amount: Float = 0.5f): Color
fun Blend.blend(from: Color, to: Color, amount: Float): Color

Blend two colors together. The hue, chroma, and tone of the original color will change.

Link copied to clipboard
fun Color.blendHue(to: Color, amount: Float = 0.5f): Color

Blends this Color into another. The chroma and tone of the original color are maintained.

fun Blend.blendHue(from: Color, to: Color, amount: Float): Color

Blends hue from one Color into another. The chroma and tone of the original color are maintained.

Link copied to clipboard

Create content key tones from a color.

Link copied to clipboard

Contrast ratio is a measure of legibility, its used to compare the lightness of two colors. This method is used commonly in industry due to its use by WCAG.

Link copied to clipboard
fun Color.darken(ratio: Float = 1.1f): Color

Darken the color by the given ratio.

Link copied to clipboard

If color is disliked, lighten it to make it likable.

Link copied to clipboard

Convert a Compose Color to Hct.

Create key tones from a color.

Generates a TonalPalette from the given color.

Generates a TonalPalette from the given Hct.

Generates a TonalPalette from the given argb color int.

Link copied to clipboard

Returns an Color that represents the color of this DynamicColor in the given scheme.

Link copied to clipboard
fun Color.harmonize(other: Color, matchSaturation: Boolean = false): Color

Blend the color's HCT hue towards the other color's HCT hue, in a way that leaves the original color recognizable and recognizably shifted towards the key color.

fun Blend.harmonize(fromColor: Color, toColor: Color, matchSaturation: Boolean = false): Color

Blend the design color's HCT hue towards the key color's HCT hue, in a way that leaves the original color recognizable and recognizably shifted towards the key color.

Link copied to clipboard
fun ColorScheme.harmonizeWithPrimary(color: Color, matchSaturation: Boolean = false): Color

Returns the Color of the given color harmonized with the ColorScheme.primary.

Link copied to clipboard
fun Color.hasEnoughContrast(other: Color, threshold: ContrastThreshold = ContrastThreshold.WCAG_AA_NORMAL_TEXT): Boolean

Check if the contrast ratio between two colors is greater than or equal to a given threshold.

Link copied to clipboard

Determine a given color is cool.

Link copied to clipboard

Returns true if color is disliked.

Link copied to clipboard

Check if the color is light.

Link copied to clipboard

Determine a given color is warm.

Link copied to clipboard
fun Color.lighten(ratio: Float = 1.0f): Color

Lighten the color by the given ratio.

Link copied to clipboard

Create key tones from a color.

Link copied to clipboard
fun QuantizerCelebi.quantize(image: ImageBitmap, maxColors: Int): Map<Int, Int>

Quantize the colors in a ImageBitmap to a maximum of maxColors colors.

Link copied to clipboard
fun rememberThemeColor(image: ImageBitmap, fallback: Color = MaterialTheme.colorScheme.primary, filter: Boolean = true, maxColors: Int = DEFAULT_QUANTIZE_MAX_COLORS): Color

Determine the most suitable color in a ImageBitmap for a UI theme.

Link copied to clipboard
fun rememberThemeColors(image: ImageBitmap, fallback: Color = MaterialTheme.colorScheme.primary, maxColors: Int = DEFAULT_QUANTIZE_MAX_COLORS, filter: Boolean = true, desired: Int = DEFAULT_DESIRED_COLORS): List<Color>

Determine the most suitable color in a ImageBitmap for a UI theme.

Link copied to clipboard

Value representing cool-warm factor of a color.

Link copied to clipboard

Design utilities using color temperature theory.

Link copied to clipboard
fun ImageBitmap.themeColor(fallback: Color, filter: Boolean = true, maxColors: Int = DEFAULT_QUANTIZE_MAX_COLORS): Color

Determine the most suitable color in a ImageBitmap for a UI theme.

Link copied to clipboard
fun ImageBitmap.themeColorOrNull(filter: Boolean = true, maxColors: Int = DEFAULT_QUANTIZE_MAX_COLORS): Color?

Determine the most suitable color in a ImageBitmap for a UI theme or null

Link copied to clipboard
fun ImageBitmap.themeColors(maxColors: Int = DEFAULT_QUANTIZE_MAX_COLORS, fallback: Color = Color(-0xbd7a0c), filter: Boolean = true, desired: Int = DEFAULT_DESIRED_COLORS): List<Color>

Rank the colors in a ImageBitmap by their suitability for being used for a UI theme.

Link copied to clipboard

Convert HCT to a Compose Color.

Link copied to clipboard

Convert a list of HCT to a list of Compose Color.

Link copied to clipboard
fun Color.toDynamicScheme(isDark: Boolean, style: PaletteStyle, contrastLevel: Double = Contrast.Default.value): DynamicScheme

Generate a DynamicScheme based on the given Color.

Link copied to clipboard
fun Color.toHct(): Hct

Convert a Compose Color to Hct.

Link copied to clipboard

Convert a list of Compose Color to a list of HCT.

Link copied to clipboard

Contrast ratio of two tones. T in HCT, L* in Lab*. Also known as luminance or perpetual luminance.