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
aandbatt(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
aandb(1–21). -
darken(
Color color, double amount) → Color -
Mixes
colortowards black byamount(0–1). -
fromHex(
String hex) → Color? -
Parses a hex string (
#RGB,#RRGGBB,#AARRGGBB, with or without#) into a Color. Returnsnullwhen the input is not valid. -
isDark(
Color color) → bool -
Whether
coloris perceived as dark. -
isLight(
Color color) → bool -
Whether
coloris perceived as light. -
isReadable(
Color fg, Color bg, {bool largeText = false}) → bool -
Whether
fgonbgmeets the WCAG AA contrast for normal text (4.5:1). -
lighten(
Color color, double amount) → Color -
Mixes
colortowards white byamount(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
colorto a hex string like#FF4F46E5.