Skip to main content

Module dynamic

Module dynamic 

Source
Expand description

Material dynamic color: HCT, tonal palettes and seed-generated schemes.

A port of Google’s material-color-utilities at commit bd811e4ca2ab94c4ce3cadc89c19b1820b9704b3, licensed under Apache-2.0 (licenses/material-color-utilities.txt). Each file keeps its notice and states that it was modified.

Not ported: the image quantizers and score (schemes start from a known seed), the watch platform and the CMF variant, the deprecated CorePalette and Scheme classes, and multiple source colors.

Modules§

blend
Blending in HCT and CAM16.
contrast
Contrast ratios between tones, and tones that reach a given ratio.
utils
Math and color-space conversions shared by the dynamic color port.

Structs§

Cam16
A color in CAM16, the appearance model behind HCT’s hue and chroma.
ContrastCurve
A value that changes with the contrast level, usually the contrast a color needs against its background.
DynamicScheme
The state a DynamicRole resolves against.
Hct
Hue, chroma and tone: CAM16 hue and chroma with L* as tone, so a tone difference predicts contrast (40 gives at least 3:1, 50 at least 4.5:1).
SeedScheme
What a generated theme is made from.
TemperatureCache
The input color with its hue circle, sorted by temperature, computed once.
TonalPalette
A hue and chroma, from which any tone can be requested.
ViewingConditions
The environment a color is seen in, with the CAM16 intermediates that depend only on it. Field names are CAM16’s own terms.

Enums§

DynamicRole
A role of a DynamicScheme.
SpecVersion
The version of Material’s color spec.
Variant
The style of a generated scheme.

Functions§

fix_if_disliked
A disliked color lightened to tone 70; any other color unchanged.
is_disliked
Whether a color is a non-neutral dark yellow-green.
raw_temperature
The cool-warm factor of a color (Ou, Woodcock and Wright, in Lab*): below 0 is cool, above 0 warm.