Skip to content
On this page

Colors

Use context-free color palettes and semantic theme roles throughout your application.

Color palette

The palette is context-free and separate from semantic UI roles:

const Color brand = Colors.blue; // shade 500
final background = Colors.zinc.shade100;
final highlight = Colors.blue.shade500;
final sameHighlight = Colors.blue[500];

ColorScale extends Flutter’s Color, so Colors.blue works directly in color properties and const themes. Its default color is shade 500. Every family provides shade50, shade100 through shade900, and shade950. Invalid indexed shades throw ArgumentError. Scales also support copyWith and value equality. Colors.black, Colors.white and Colors.transparent are individual colors.

Available families: slate, gray, zinc, neutral, stone, red, orange, amber, yellow, lime, green, emerald, teal, cyan, sky, blue, indigo, violet, purple, fuchsia, pink, and rose. Ramps use the Tailwind CSS 3.4 hex palette; attribution is in the source package’s third-party notices.

The scales are const colors. Colors.blue can be used in const expressions. Dart does not allow reading an instance field in a constant expression, so an explicit shade such as Colors.blue.shade600 uses final.

Semantic colors

Use context.theme.colors for semantic roles such as brand, onBrand, surface, and foreground. These values follow the active theme; palette colors remain fixed. See theming for configuring light and dark color groups.

DartFlutter

Get started with FluttyUI