Skip to main content
1

💡 Accessibility & Contrast

double
The relative luminance of the color (0.0=black, 1.0=white). Essential for contrast calculations.
bool
Checks if the color is perceived as dark (luminance < 0.5). Use this to decide if white text should be used.
bool
Checks if the color is perceived as light (luminance ≥ 0.5). Use this to decide if dark text should be used.
2

⚙️ Manipulation & Conversion

Color
Lightens the color by a specified factor (0.0 to 1.0). Alpha channel is preserved.
String
Converts the color to its hexadecimal string representation.
3

🎨 The Swatch Creator

MaterialColor
Generates a full 10-shade MaterialColor swatch (50-900) from a single base color. The ultimate shortcut for ThemeData.primarySwatch.