material_color_utilities library

Classes

Blend
Functions for blending in HCT and CAM16.
Box
Cam16
CAM16, a color appearance model. Colors are not just defined by their hex code, but rather, a hex code and viewing conditions.
ColorUtils
Color science utilities.
Contrast
Utility methods for calculating contrast given two colors, or calculating a color given one color and a contrast ratio.
CorePalette
An intermediate concept between the key color for a UI theme, and a full color scheme. 5 tonal palettes are generated, all except one use the same hue as the key color, and all vary in chroma.
CreateBoxesResult
DislikeAnalyzer
Check and/or fix universally disliked colors.
DistanceAndIndex
DynamicColor
A color that adjusts itself based on UI state provided by DynamicScheme.
DynamicScheme
Constructed by a set of values representing the current UI state (such as whether or not its dark theme, what the theme style is, etc.), and provides a set of TonalPalettes that can create colors that fit in with the theme style. Used by DynamicColor to resolve into a color.
Hct
HCT, hue, chroma, and tone. A color system that provides a perceptually accurate color measurement system that can also accurately render what colors will appear as in different lighting environments.
MaterialDynamicColors
Tokens, or named colors, in the Material Design system.
MathUtils
Utility methods for mathematical operations.
MaximizeResult
Quantizer
QuantizerCelebi
QuantizerMap
QuantizerResult
QuantizerWsmeans
QuantizerWu
Scheme
Prefer ColorScheme. This class is the same concept as Flutter's ColorScheme class, inlined to ensure parity across languages.
SchemeContent
A scheme that places the source color in Scheme.primaryContainer.
SchemeExpressive
A Dynamic Color theme that is intentionally detached from the input color.
SchemeFidelity
A scheme that places the source color in Scheme.primaryContainer.
SchemeMonochrome
A Dynamic Color theme that is grayscale.
SchemeNeutral
A Dynamic Color theme that is near grayscale.
SchemeTonalSpot
A Dynamic Color theme with low to medium colorfulness and a Tertiary TonalPalette with a hue related to the source color. The default Material You theme on Android 12 and 13.
SchemeVibrant
A Dynamic Color theme that maxes out colorfulness at each position in the Primary TonalPalette.
Score
Given a large set of colors, remove colors that are unsuitable for a UI theme, and rank the rest based on suitability.
StringUtils
TemperatureCache
Design utilities using color temperature theory.
TonalPalette
A convenience class for retrieving colors that are constant in hue and chroma, but vary in tone.
ViewingConditions
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.

Enums

Direction
Variant
Set of themes supported by Dynamic Color. Instantiate the corresponding subclass, ex. SchemeTonalSpot, to create colors corresponding to the theme.