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
Static Methods
-
adjustLightness(Color color, {required double amount, required bool darken})
→ Color
-
-
adjustSaturation(Color color, {required double amount, required bool desaturate})
→ Color
-
-
analogous(Color color, {int count = 2, double spreadDegrees = 30})
→ List<Color>
-
Returns
count analogous colors evenly spaced around color.
spreadDegrees controls the total arc (default 30° each side).
-
bestContrast(Color background, [List<Color> candidates = const [Colors.white, Colors.black]])
→ Color
-
Picks whichever of
candidates has the highest contrast against background.
Defaults to black/white if no candidates supplied.
-
complementary(Color color)
→ Color
-
Returns the complementary color (hue + 180°).
-
contrastRatio(Color a, Color b)
→ double
-
Returns the WCAG contrast ratio between two colors (1–21).
-
createMaterialColor(Color color)
→ MaterialColor
-
Generates a MaterialColor swatch using HSL lightness steps so shades
match Material Design intent rather than raw RGB blending.
-
greyscale(Color color)
→ Color
-
Removes all saturation — equivalent to a greyscale conversion.
-
isDark(Color color)
→ bool
-
WCAG 2.1 relative luminance. Threshold 0.179 gives 4.5:1 contrast ratio.
-
isLight(Color color)
→ bool
-
-
meetsWcagAA(Color foreground, Color background)
→ bool
-
AA = 4.5:1 for normal text, AAA = 7:1.
-
meetsWcagAAA(Color foreground, Color background)
→ bool
-
-
mix(Color a, Color b, [double t = 0.5])
→ Color
-
Linear interpolation between
a and b in sRGB space.
t = 0.0 → a, t = 1.0 → b.
-
shade(Color color, [double amount = 0.5])
→ Color
-
Mixes
color with black.
-
splitComplementary(Color color)
→ (Color, Color)
-
Returns a split-complementary palette (hue + 150° and hue + 210°).
-
tint(Color color, [double amount = 0.5])
→ Color
-
Mixes
color with white.
-
toHexARGB(Color color, {bool withHashSign = true})
→ String
-
Outputs 8-char ARGB hex including alpha:
#CCFF5500.
-
toHexRGB(Color color, {bool withHashSign = true})
→ String
-
Outputs 6-char RGB hex, ignoring alpha:
#FF5500.
-
triadic(Color color)
→ (Color, Color)
-
Returns a triadic palette (hue ± 120°).
-
tryParseHex(String hex)
→ Color?
-
Parses
#RGB, #RRGGBB, #AARRGGBB (hash optional).