getRotatedHue

fun getRotatedHue(sourceColorHct: Hct, hueBreakpoints: DoubleArray, rotations: DoubleArray): Double

Returns a shifted hue based on a piecewise function and input color hue.

For example, for the following function:

result = hue + 26, if 0 <= hue < 101
result = hue - 39, if 101 <= hue < 210
result = hue + 28, if 210 <= hue < 360

call the function as:

val hueBreakpoints = listOf(0, 101, 210, 360)
val rotations = listOf(26, -39, 28)
val result = scheme.getRotatedHue(sourceColor, hueBreakpoints, rotations)

Parameters

sourceColorHct

the source color of the theme, in HCT.

hueBreakpoints

The "breakpoints", i.e. the hues at which a rotation should be apply. No default lower or upper bounds are assumed.

rotations

The rotation that should be applied when source color's hue is >= the same index in hues array, and < the hue at the next index in hues array. Otherwise, the source color's hue is returned.