ColorUtils
A set of color-related utility methods, building upon those available in Color
.
Functions
Link copied to clipboard
Link copied to clipboard
Returns the luminance of a color as a float between
0.0
and 1.0
.Link copied to clipboard
Link copied to clipboard
Convert the ARGB color to its HSL (hue-saturation-lightness) components.
Link copied to clipboard
Convert the ARGB color to its CIE Lab representative components.
Link copied to clipboard
Link copied to clipboard
Convert the ARGB color to its CIE XYZ representative components.
Link copied to clipboard
@NonNull
Composites two translucent colors together.
Composite two potentially translucent colors over each other and returns the result.
Link copied to clipboard
Link copied to clipboard
Convert HSL (hue-saturation-lightness) components to a RGB color.
Link copied to clipboard
open fun LABToColor(@FloatRange(from = 0.0, to = 100) l: Double, @FloatRange(from = "-128", to = 127) a: Double, @FloatRange(from = "-128", to = 127) b: Double): Int
Converts a color from CIE Lab to its RGB representation.
Link copied to clipboard
open fun LABToXYZ(@FloatRange(from = 0.0, to = 100) l: Double, @FloatRange(from = "-128", to = 127) a: Double, @FloatRange(from = "-128", to = 127) b: Double, outXyz: @NonNull Array<Double>)
Converts a color from CIE Lab to CIE XYZ representation.
Link copied to clipboard
open fun M3HCTToColor(@FloatRange(from = 0.0, to = 360, toInclusive = false) hue: Float, @FloatRange(from = 0.0, to = Double.POSITIVE_INFINITY, toInclusive = false) chroma: Float, @FloatRange(from = 0.0, to = 100) tone: Float): Int
Generate an ARGB color using M3HCT color parameters.
Link copied to clipboard
Link copied to clipboard
open fun XYZToColor(@FloatRange(from = 0.0, to = 95.047) x: Double, @FloatRange(from = 0.0, to = 100.0) y: Double, @FloatRange(from = 0.0, to = 108.883) z: Double): Int
Converts a color from CIE XYZ to its RGB representation.
Link copied to clipboard
open fun XYZToLAB(@FloatRange(from = 0.0, to = 95.047) x: Double, @FloatRange(from = 0.0, to = 100.0) y: Double, @FloatRange(from = 0.0, to = 108.883) z: Double, outLab: @NonNull Array<Double>)
Converts a color from CIE XYZ to CIE Lab representation.