Package-level declarations

Types

Link copied to clipboard
Link copied to clipboard
interface Color

A color that can be converted to other representations.

Link copied to clipboard
class ColorComponentInfo(val name: String, val isPolar: Boolean)
Link copied to clipboard
interface ColorSpace<T : Color>
Link copied to clipboard
interface HueColor : Color
Link copied to clipboard
object Illuminant

Standard CIE Illuminants under the 2° observer

Link copied to clipboard
Link copied to clipboard
data class WhitePoint(val name: String, val chromaticity: xyY)

A named chromaticity

Link copied to clipboard

A color space that is defined with a reference whitePoint.

Functions

Link copied to clipboard
fun <T : Color> Color.convertTo(space: ColorSpace<T>): T

Convert this color to a given space.

Link copied to clipboard
fun Color.formatCssString(hueUnit: AngleUnit = AngleUnit.AUTO, renderAlpha: RenderCondition = RenderCondition.AUTO, unitsPercent: Boolean = false, alphaPercent: Boolean = false, legacyName: Boolean = false, legacyFormat: Boolean = false): String

Render this color in CSS functional notation.

Link copied to clipboard
fun Color.formatCssStringOrNull(hueUnit: AngleUnit = AngleUnit.AUTO, renderAlpha: RenderCondition = RenderCondition.AUTO, unitsPercent: Boolean = false, alphaPercent: Boolean = false, legacyName: Boolean = false, legacyFormat: Boolean = false): String?

Render this color in CSS functional notation if this color space is defined in the CSS standard, or return null if this color is in another color space.

Link copied to clipboard

Convert this color's hue to gradians (360° == 400 gradians)

Link copied to clipboard

Convert this color's hue to radians (360° == 2π radians)

Link copied to clipboard

Convert this color's hue to turns (360° == 1 turn)

Link copied to clipboard
fun HueColor.hueOr(whenNaN: Number): Float

If this color's hue is NaN (meaning the hue is undefined), return whenNaN. Otherwise, return the hue unchanged.

Link copied to clipboard

Parse a string representing a CSS color value.

Link copied to clipboard

Parse a string representing a CSS color value, or return null if the string isn't in a recognized format.