Cam16

class Cam16

CAM16, a color appearance model. Colors are not just defined by their hex code, but rather, a hex code and viewing conditions.

CAM16 instances also have coordinates in the CAM16-UCS space, called J*, a*, b*, or jstar, astar, bstar in code. CAM16-UCS is included in the CAM16 specification, and should be used when measuring distances between colors.

In traditional color spaces, a color can be identified solely by the observer's measurement of the color. Color appearance models such as CAM16 also use information about the environment where the color was observed, known as the viewing conditions.

For example, white under the traditional assumption of a midday sun white point is accurately measured as a slightly chromatic blue by CAM16. (roughly, hue 203, chroma 3, lightness 100) All of the CAM16 dimensions can be calculated from 3 of the dimensions, in the following combinations: - {j or q} and {c, m, or s} and hue - jstar, astar, bstar Prefer using a static method that constructs from 3 of those dimensions. This constructor is intended for those methods to use to return all possible dimensions.

Parameters

hue

for example, red, orange, yellow, green, etc.

chroma

informally, colorfulness / color intensity. like saturation in HSL, except perceptually accurate.

j

lightness

q

brightness; ratio of lightness to white point's lightness Prefer lightness, brightness is an absolute quantity. For example, a sheet of white paper is much brighter viewed in sunlight than in indoor light, but it is the lightest object under any lighting.

m

colorfulness. Prefer chroma, colorfulness is an absolute quantity. For example, a yellow toy car is much more colorful outside than inside, but it has the same chroma in both environments.

s

saturation; ratio of chroma to white point's chroma. Colorfulness in proportion to brightness. Prefer chroma, saturation measures colorfulness relative to the color's own brightness, where chroma is colorfulness relative to white.

jstar

CAM16-UCS J coordinate Used to determine color distance, like delta E equations in Lab*

astar

CAM16-UCS a coordinate

bstar

CAM16-UCS b coordinate

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val hue: Double
Link copied to clipboard
val j: Double
Link copied to clipboard
Link copied to clipboard
val m: Double
Link copied to clipboard
val q: Double
Link copied to clipboard
val s: Double

Functions

Link copied to clipboard
fun distance(other: Cam16): Double

CAM16 instances also have coordinates in the CAM16-UCS space, called J*, a*, b*, or jstar, astar, bstar in code. CAM16-UCS is included in the CAM16 specification, and is used to measure distances between colors.

Link copied to clipboard
fun toInt(): Int

ARGB representation of the color. Assumes the color was viewed in default viewing conditions, which are near-identical to the default viewing conditions for sRGB.

Link copied to clipboard
fun viewed(viewingConditions: ViewingConditions): Int

ARGB representation of the color, in defined viewing conditions.

Link copied to clipboard
fun xyzInViewingConditions(viewingConditions: ViewingConditions, returnArray: DoubleArray?): DoubleArray