ConversionGraph

object ConversionGraph

Global color conversion graph, used for automatic conversions between different color spaces.

Functions

add
Link copied to clipboard
inline fun <F : Color, T : Color> add(crossinline converter: (F) -> T)

Add a conversion from color type F to T, specified as generic types. This is a convenient wrapper for add.

fun add(from: ColorType, to: ColorType, converter: ColorConverter<Color, Color>)

Add a one-way conversion from color type from to to. You should also add a matching reverse conversion, i.e. from to to from.

convert
Link copied to clipboard
inline fun <T : Color> Color.convert(): T

Convert this color to color space T.

fun convert(fromColor: Color, toType: ColorType): Color?

Convert fromColor to color space toType.