Colors class - material library (original) (raw)

Color and ColorSwatch constants which represent Material design'scolor palette.

Instead of using an absolute color from these palettes, consider usingTheme.of to obtain the local ThemeData.colorScheme, which defines the colors that most of the Material components use by default.

Most swatches have colors from 100 to 900 in increments of one hundred, plus the color 50. The smaller the number, the more pale the color. The greater the number, the darker the color. The accent swatches (e.g. redAccent) only have the values 100, 200, 400, and 700.

In addition, a series of blacks and whites with common opacities are available. For example, black54 is a pure black with 54% opacity.

To select a specific color from one of the swatches, index into the swatch using an integer for the specific color desired, as follows:

link

Color selection = Colors.green[400]!; // Selects a mid-range green.

Each ColorSwatch constant is a color and can used directly. For example:

link

Container(
  color: Colors.blue, // same as Colors.blue[500] or Colors.blue.shade500
)

Color palettes

Blacks and whites

These colors are identified by their transparency. The low transparency levels (e.g. Colors.white12 and Colors.white10) are very hard to see and should be avoided in general. They are intended for very subtle effects.

The Colors.transparent color isn't shown here because it is entirely invisible!

See also:

Properties

hashCodeint

The hash code for this object.

no setterinherited

runtimeTypeType

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

Constants

accents → const List<MaterialAccentColor>

The Material Design accent color swatches.

amber → const MaterialColor

The amber primary color and swatch.

amberAccent → const MaterialAccentColor

The amber accent color and swatch.

black → const Color

Completely opaque black.

black12 → const Color

Black with 12% opacity.

black26 → const Color

Black with 26% opacity.

black38 → const Color

Black with 38% opacity.

black45 → const Color

Black with 45% opacity.

black54 → const Color

Black with 54% opacity.

black87 → const Color

Black with 87% opacity.

blue → const MaterialColor

The blue primary color and swatch.

blueAccent → const MaterialAccentColor

The blue accent color and swatch.

blueGrey → const MaterialColor

The blue-grey primary color and swatch.

brown → const MaterialColor

The brown primary color and swatch.

cyan → const MaterialColor

The cyan primary color and swatch.

cyanAccent → const MaterialAccentColor

The cyan accent color and swatch.

deepOrange → const MaterialColor

The deep orange primary color and swatch.

deepOrangeAccent → const MaterialAccentColor

The deep orange accent color and swatch.

deepPurple → const MaterialColor

The deep purple primary color and swatch.

deepPurpleAccent → const MaterialAccentColor

The deep purple accent color and swatch.

green → const MaterialColor

The green primary color and swatch.

greenAccent → const MaterialAccentColor

The green accent color and swatch.

grey → const MaterialColor

The grey primary color and swatch.

indigo → const MaterialColor

The indigo primary color and swatch.

indigoAccent → const MaterialAccentColor

The indigo accent color and swatch.

lightBlue → const MaterialColor

The light blue primary color and swatch.

lightBlueAccent → const MaterialAccentColor

The light blue accent swatch.

lightGreen → const MaterialColor

The light green primary color and swatch.

lightGreenAccent → const MaterialAccentColor

The light green accent color and swatch.

lime → const MaterialColor

The lime primary color and swatch.

limeAccent → const MaterialAccentColor

The lime accent primary color and swatch.

orange → const MaterialColor

The orange primary color and swatch.

orangeAccent → const MaterialAccentColor

The orange accent color and swatch.

pink → const MaterialColor

The pink primary color and swatch.

pinkAccent → const MaterialAccentColor

The pink accent color swatch.

primaries → const List<MaterialColor>

The Material Design primary color swatches, excluding grey.

purple → const MaterialColor

The purple primary color and swatch.

purpleAccent → const MaterialAccentColor

The purple accent color and swatch.

red → const MaterialColor

The red primary color and swatch.

redAccent → const MaterialAccentColor

The red accent swatch.

teal → const MaterialColor

The teal primary color and swatch.

tealAccent → const MaterialAccentColor

The teal accent color and swatch.

transparent → const Color

Completely invisible.

white → const Color

Completely opaque white.

white10 → const Color

White with 10% opacity.

white12 → const Color

White with 12% opacity.

white24 → const Color

White with 24% opacity.

white30 → const Color

White with 30% opacity.

white38 → const Color

White with 38% opacity.

white54 → const Color

White with 54% opacity.

white60 → const Color

White with 60% opacity.

white70 → const Color

White with 70% opacity.

yellow → const MaterialColor

The yellow primary color and swatch.

yellowAccent → const MaterialAccentColor

The yellow accent color and swatch.