ColorUtils class abstract final

Color manipulation and accessibility helpers.

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

blend(Color a, Color b, double t) → Color
Linearly interpolates between a and b at t (clamped to 0–1).
contrastFor(Color background) → Color
Returns black or white depending on which contrasts best with background.
contrastRatio(Color a, Color b) → double
The WCAG contrast ratio between a and b (1–21).
darken(Color color, double amount) → Color
Mixes color towards black by amount (0–1).
fromHex(String hex) → Color?
Parses a hex string (#RGB, #RRGGBB, #AARRGGBB, with or without #) into a Color. Returns null when the input is not valid.
isDark(Color color) → bool
Whether color is perceived as dark.
isLight(Color color) → bool
Whether color is perceived as light.
isReadable(Color fg, Color bg, {bool largeText = false}) → bool
Whether fg on bg meets the WCAG AA contrast for normal text (4.5:1).
lighten(Color color, double amount) → Color
Mixes color towards white by amount (0–1).
luminance(Color color) → double
The relative luminance of color (0–1, WCAG definition).
pow2(double value) → double
toHex(Color color, {bool withAlpha = true}) → String
Converts color to a hex string like #FF4F46E5.