Class

ColorScheme

A color scheme holds all the named color parameters for a MaterialTheme.

Source set: Common
public class ColorScheme(
    public val primary: Color,
    public val onPrimary: Color,
    public val primaryContainer: Color,
    public val onPrimaryContainer: Color,
    public val inversePrimary: Color,
    public val secondary: Color,
    public val onSecondary: Color,
    public val secondaryContainer: Color,
    public val onSecondaryContainer: Color,
    public val tertiary: Color,
    public val onTertiary: Color,
    public val tertiaryContainer: Color,
    public val onTertiaryContainer: Color,
    public val background: Color,
    public val onBackground: Color,
    public val surface: Color,
    public val onSurface: Color,
    public val surfaceVariant: Color,
    public val onSurfaceVariant: Color,
    public val surfaceTint: Color,
    public val inverseSurface: Color,
    public val inverseOnSurface: Color,
    public val error: Color,
    public val onError: Color,
    public val errorContainer: Color,
    public val onErrorContainer: Color,
    public val outline: Color,
    public val outlineVariant: Color,
    public val scrim: Color,
    public val surfaceBright: Color,
    public val surfaceDim: Color,
    public val surfaceContainer: Color,
    public val surfaceContainerHigh: Color,
    public val surfaceContainerHighest: Color,
    public val surfaceContainerLow: Color,
    public val surfaceContainerLowest: Color,
    public val primaryFixed: Color,
    public val primaryFixedDim: Color,
    public val onPrimaryFixed: Color,
    public val onPrimaryFixedVariant: Color,
    public val secondaryFixed: Color,
    public val secondaryFixedDim: Color,
    public val onSecondaryFixed: Color,
    public val onSecondaryFixedVariant: Color,
    public val tertiaryFixed: Color,
    public val tertiaryFixedDim: Color,
    public val onTertiaryFixed: Color,
    public val onTertiaryFixedVariant: Color,
)

A color scheme holds all the named color parameters for a MaterialTheme.

Color schemes are designed to be harmonious, ensure accessible text, and distinguish UI elements and surfaces from one another. There are two built-in baseline schemes, lightColorScheme and a darkColorScheme, that can be used as-is or customized.

The Material color system and custom schemes provide default values for color as a starting point for customization.

To learn more about colors, see Material Design colors.

Functions

copy

Source set: Common
public fun copy(
        primary: Color = this.primary,
        onPrimary: Color = this.onPrimary,
        primaryContainer: Color = this.primaryContainer,
        onPrimaryContainer: Color = this.onPrimaryContainer,
        inversePrimary: Color = this.inversePrimary,
        secondary: Color = this.secondary,
        onSecondary: Color = this.onSecondary,
        secondaryContainer: Color = this.secondaryContainer,
        onSecondaryContainer: Color = this.onSecondaryContainer,
        tertiary: Color = this.tertiary,
        onTertiary: Color = this.onTertiary,
        tertiaryContainer: Color = this.tertiaryContainer,
        onTertiaryContainer: Color = this.onTertiaryContainer,
        background: Color = this.background,
        onBackground: Color = this.onBackground,
        surface: Color = this.surface,
        onSurface: Color = this.onSurface,
        surfaceVariant: Color = this.surfaceVariant,
        onSurfaceVariant: Color = this.onSurfaceVariant,
        surfaceTint: Color = this.surfaceTint,
        inverseSurface: Color = this.inverseSurface,
        inverseOnSurface: Color = this.inverseOnSurface,
        error: Color = this.error,
        onError: Color = this.onError,
        errorContainer: Color = this.errorContainer,
        onErrorContainer: Color = this.onErrorContainer,
        outline: Color = this.outline,
        outlineVariant: Color = this.outlineVariant,
        scrim: Color = this.scrim,
        surfaceBright: Color = this.surfaceBright,
        surfaceDim: Color = this.surfaceDim,
        surfaceContainer: Color = this.surfaceContainer,
        surfaceContainerHigh: Color = this.surfaceContainerHigh,
        surfaceContainerHighest: Color = this.surfaceContainerHighest,
        surfaceContainerLow: Color = this.surfaceContainerLow,
        surfaceContainerLowest: Color = this.surfaceContainerLowest,
        primaryFixed: Color = this.primaryFixed,
        primaryFixedDim: Color = this.primaryFixedDim,
        onPrimaryFixed: Color = this.onPrimaryFixed,
        onPrimaryFixedVariant: Color = this.onPrimaryFixedVariant,
        secondaryFixed: Color = this.secondaryFixed,
        secondaryFixedDim: Color = this.secondaryFixedDim,
        onSecondaryFixed: Color = this.onSecondaryFixed,
        onSecondaryFixedVariant: Color = this.onSecondaryFixedVariant,
        tertiaryFixed: Color = this.tertiaryFixed,
        tertiaryFixedDim: Color = this.tertiaryFixedDim,
        onTertiaryFixed: Color = this.onTertiaryFixed,
        onTertiaryFixedVariant: Color = this.onTertiaryFixedVariant,
    ): ColorScheme

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

copy

Source set: Common
@Deprecated(
        message =
            "Maintained for binary compatibility. Use overload with additional fixed roles " +
                "instead",
        level = DeprecationLevel.HIDDEN,
    )
    public fun copy(
        primary: Color = this.primary,
        onPrimary: Color = this.onPrimary,
        primaryContainer: Color = this.primaryContainer,
        onPrimaryContainer: Color = this.onPrimaryContainer,
        inversePrimary: Color = this.inversePrimary,
        secondary: Color = this.secondary,
        onSecondary: Color = this.onSecondary,
        secondaryContainer: Color = this.secondaryContainer,
        onSecondaryContainer: Color = this.onSecondaryContainer,
        tertiary: Color = this.tertiary,
        onTertiary: Color = this.onTertiary,
        tertiaryContainer: Color = this.tertiaryContainer,
        onTertiaryContainer: Color = this.onTertiaryContainer,
        background: Color = this.background,
        onBackground: Color = this.onBackground,
        surface: Color = this.surface,
        onSurface: Color = this.onSurface,
        surfaceVariant: Color = this.surfaceVariant,
        onSurfaceVariant: Color = this.onSurfaceVariant,
        surfaceTint: Color = this.surfaceTint,
        inverseSurface: Color = this.inverseSurface,
        inverseOnSurface: Color = this.inverseOnSurface,
        error: Color = this.error,
        onError: Color = this.onError,
        errorContainer: Color = this.errorContainer,
        onErrorContainer: Color = this.onErrorContainer,
        outline: Color = this.outline,
        outlineVariant: Color = this.outlineVariant,
        scrim: Color = this.scrim,
    ): ColorScheme

copy

Source set: Common
@Deprecated(
        message =
            "Maintained for binary compatibility. Use overload with additional fixed roles " +
                "instead",
        level = DeprecationLevel.HIDDEN,
    )
    public fun copy(
        primary: Color = this.primary,
        onPrimary: Color = this.onPrimary,
        primaryContainer: Color = this.primaryContainer,
        onPrimaryContainer: Color = this.onPrimaryContainer,
        inversePrimary: Color = this.inversePrimary,
        secondary: Color = this.secondary,
        onSecondary: Color = this.onSecondary,
        secondaryContainer: Color = this.secondaryContainer,
        onSecondaryContainer: Color = this.onSecondaryContainer,
        tertiary: Color = this.tertiary,
        onTertiary: Color = this.onTertiary,
        tertiaryContainer: Color = this.tertiaryContainer,
        onTertiaryContainer: Color = this.onTertiaryContainer,
        background: Color = this.background,
        onBackground: Color = this.onBackground,
        surface: Color = this.surface,
        onSurface: Color = this.onSurface,
        surfaceVariant: Color = this.surfaceVariant,
        onSurfaceVariant: Color = this.onSurfaceVariant,
        surfaceTint: Color = this.surfaceTint,
        inverseSurface: Color = this.inverseSurface,
        inverseOnSurface: Color = this.inverseOnSurface,
        error: Color = this.error,
        onError: Color = this.onError,
        errorContainer: Color = this.errorContainer,
        onErrorContainer: Color = this.onErrorContainer,
        outline: Color = this.outline,
        outlineVariant: Color = this.outlineVariant,
        scrim: Color = this.scrim,
        surfaceBright: Color = this.surfaceBright,
        surfaceDim: Color = this.surfaceDim,
        surfaceContainer: Color = this.surfaceContainer,
        surfaceContainerHigh: Color = this.surfaceContainerHigh,
        surfaceContainerHighest: Color = this.surfaceContainerHighest,
        surfaceContainerLow: Color = this.surfaceContainerLow,
        surfaceContainerLowest: Color = this.surfaceContainerLowest,
    ): ColorScheme

toString

Source set: Common
override fun toString(): String
Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: