Class TemperatureCache
Analogous colors, complementary color, and cache to efficiently, lazily, generate data for calculations when needed.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription5 colors that pair well with the input color.getAnalogousColors(int count, int divisions) A set of colors with differing hues, equidistant in temperature.A color that complements the input color aesthetically.doubleTemperature relative to all colors with the same chroma and tone.static doublerawTemperature(Hct color) Value representing cool-warm factor of a color.
-
Constructor Details
-
TemperatureCache
Create a cache that allows calculation of ex. complementary and analogous colors.- Parameters:
input- Color to find complement/analogous colors of. Any colors will have the same tone, and chroma as the input color, modulo any restrictions due to the other hues having lower limits on chroma.
-
-
Method Details
-
getComplement
A color that complements the input color aesthetically.In art, this is usually described as being across the color wheel. History of this shows intent as a color that is just as cool-warm as the input color is warm-cool.
-
getAnalogousColors
-
getAnalogousColors
A set of colors with differing hues, equidistant in temperature.In art, this is usually described as a set of 5 colors on a color wheel divided into 12 sections. This method allows provision of either of those values.
Behavior is undefined when count or divisions is 0. When divisions invalid input: '<' count, colors repeat.
- Parameters:
count- The number of colors to return, includes the input color.divisions- The number of divisions on the color wheel.
-
getRelativeTemperature
Temperature relative to all colors with the same chroma and tone.- Parameters:
hct- HCT to find the relative temperature of.- Returns:
- Value on a scale from 0 to 1.
-
rawTemperature
Value representing cool-warm factor of a color. Values below 0 are considered cool, above, warm.Color science has researched emotion and harmony, which art uses to select colors. Warm-cool is the foundation of analogous and complementary colors. See: - Li-Chen Ou's Chapter 19 in Handbook of Color Psychology (2015). - Josef Albers' Interaction of Color chapters 19 and 21.
Implementation of Ou, Woodcock and Wright's algorithm, which uses Lab/LCH color space. Return value has these properties:
- Values below 0 are cool, above 0 are warm.
- Lower bound: -9.66. Chroma is infinite. Assuming max of Lab chroma 130.
- Upper bound: 8.61. Chroma is infinite. Assuming max of Lab chroma 130.
-