ChromaKit extension

ChromaKit provides a robust set of utilities for dynamic color manipulation in Flutter.

This extension handles common design challenges such as creating pastel shades, ensuring accessibility contrast, and safe hex parsing.

on

Properties

contrastColor Color

Available on Color, provided by the ChromaKit extension

Returns Colors.black or Colors.white depending on the color's brightness.
no setter
isDark bool

Available on Color, provided by the ChromaKit extension

Checks if the color is dark based on its luminance value.
no setter

Methods

darken([double factor = 0.1]) Color

Available on Color, provided by the ChromaKit extension

Darkens the color by blending it with black.
faint([double factor = 0.9]) Color

Available on Color, provided by the ChromaKit extension

Blends the color with pure white to create a solid pastel tint.
faintWith(Color other, [double factor = 0.9]) Color

Available on Color, provided by the ChromaKit extension

Blends the color with a specific other color.
faintWiths(List<Color> others, [double factor = 0.9]) Color

Available on Color, provided by the ChromaKit extension

Blends the color with the calculated average of a list of others.
lighten([double factor = 0.1]) Color

Available on Color, provided by the ChromaKit extension

Lightens the color by blending it with white.
toHex({bool includeHash = true}) String

Available on Color, provided by the ChromaKit extension

Returns the color in Hexadecimal string format (e.g., #FF6200EE).
transparency(double fraction) Color

Available on Color, provided by the ChromaKit extension

Adjusts the alpha channel of the color based on a fraction.
withOpacityFraction(double fraction) Color

Available on Color, provided by the ChromaKit extension

An alias for opacity for backward compatibility.

Static Methods

fromHex(String hexString) Color

Available on Color, provided by the ChromaKit extension

Safely creates a Color from a hex string.