Google is committed to advancing racial equity for Black communities. See how.

Colors

@Stable class Colors
kotlin.Any
   ↳ androidx.compose.material.Colors

Collection of colors in the Material color specification

To create a light set of colors using the baseline values, use lightColors To create a dark set of colors using the baseline values, use darkColors

Summary

Public constructors
<init>(primary: Color, primaryVariant: Color, secondary: Color, secondaryVariant: Color, background: Color, surface: Color, error: Color, onPrimary: Color, onSecondary: Color, onBackground: Color, onSurface: Color, onError: Color, isLight: Boolean)

Collection of colors in the Material color specification

Public methods
Colors
copy(primary: Color = this.primary, primaryVariant: Color = this.primaryVariant, secondary: Color = this.secondary, secondaryVariant: Color = this.secondaryVariant, background: Color = this.background, surface: Color = this.surface, error: Color = this.error, onPrimary: Color = this.onPrimary, onSecondary: Color = this.onSecondary, onBackground: Color = this.onBackground, onSurface: Color = this.onSurface, onError: Color = this.onError, isLight: Boolean = this.isLight)

Returns a copy of this Colors, optionally overriding some of the values.

String

Extension functions
From androidx.compose.material
Color

Tries to match color to a color in this Colors, and then returns the corresponding on color.

Properties
Color

The background color appears behind scrollable content.

Color

The error color is used to indicate error within components, such as text fields.

Boolean

Whether this Colors is considered as a 'light' or 'dark' set of colors.

Color

Color used for text and icons displayed on top of the background color.

Color

Color used for text and icons displayed on top of the error color.

Color

Color used for text and icons displayed on top of the primary color.

Color

Color used for text and icons displayed on top of the secondary color.

Color

Color used for text and icons displayed on top of the surface color.

Color

The primary color is the color displayed most frequently across your app’s screens and components.

Color

The primary variant color is used to distinguish two elements of the app using the primary color, such as the top app bar and the system bar.

Color

The secondary color provides more ways to accent and distinguish your product.

Color

The secondary variant color is used to distinguish two elements of the app using the secondary color.

Color

The surface color is used on surfaces of components, such as cards, sheets and menus.

Extension properties
From androidx.compose.material
Color

primarySurface represents the background color of components that are Colors.primary in light theme, and Colors.surface in dark theme, such as androidx.compose.material.TabRow and androidx.compose.material.TopAppBar.

Public constructors

<init>

Colors(
    primary: Color,
    primaryVariant: Color,
    secondary: Color,
    secondaryVariant: Color,
    background: Color,
    surface: Color,
    error: Color,
    onPrimary: Color,
    onSecondary: Color,
    onBackground: Color,
    onSurface: Color,
    onError: Color,