class ColorScheme


A ColorScheme 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.

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

To learn more about color schemes, see Material Design Color System.

Summary

Public constructors

ColorScheme(
    primary: ColorBuilders.ColorProp,
    primaryDim: ColorBuilders.ColorProp,
    primaryContainer: ColorBuilders.ColorProp,
    onPrimary: ColorBuilders.ColorProp,
    onPrimaryContainer: ColorBuilders.ColorProp,
    secondary: ColorBuilders.ColorProp,
    secondaryDim: ColorBuilders.ColorProp,
    secondaryContainer: ColorBuilders.ColorProp,
    onSecondary: ColorBuilders.ColorProp,
    onSecondaryContainer: ColorBuilders.ColorProp,
    tertiary: ColorBuilders.ColorProp,
    tertiaryDim: ColorBuilders.ColorProp,
    tertiaryContainer: ColorBuilders.ColorProp,
    onTertiary: ColorBuilders.ColorProp,
    onTertiaryContainer: ColorBuilders.ColorProp,
    surfaceContainerLow: ColorBuilders.ColorProp,
    surfaceContainer: ColorBuilders.ColorProp,
    surfaceContainerHigh: ColorBuilders.ColorProp,
    onSurface: ColorBuilders.ColorProp,
    onSurfaceVariant: ColorBuilders.ColorProp,
    outline: ColorBuilders.ColorProp,
    outlineVariant: ColorBuilders.ColorProp,
    background: ColorBuilders.ColorProp,
    onBackground: ColorBuilders.ColorProp,
    error: ColorBuilders.ColorProp,
    onError: ColorBuilders.ColorProp,
    errorContainer: ColorBuilders.ColorProp,
    onErrorContainer: ColorBuilders.ColorProp
)

Public properties

ColorBuilders.ColorProp

color that appears behind other content

ColorBuilders.ColorProp

color that indicates remove, delete, close or dismiss actions.

ColorBuilders.ColorProp

is color that indicates errors or emergency actions, such as safety alerts.

ColorBuilders.ColorProp

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

ColorBuilders.ColorProp

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

ColorBuilders.ColorProp

is color used for text and icons on the errorContainer color

ColorBuilders.ColorProp

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

ColorBuilders.ColorProp

color (and state variants) that should be used for content on top of primaryContainer

ColorBuilders.ColorProp

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

ColorBuilders.ColorProp

color (and state variants) should be used for content on top of secondaryContainer

ColorBuilders.ColorProp

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

ColorBuilders.ColorProp

is the color for secondary text and icons on top of surfaceContainer

ColorBuilders.ColorProp

color is used for text and icons displayed on top of the tertiary color

ColorBuilders.ColorProp

color (and state variants) that should be used for content on top of tertiaryContainer

ColorBuilders.ColorProp

is the main color for primary outline components.

ColorBuilders.ColorProp

is the secondary color for secondary outline components

ColorBuilders.ColorProp

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

ColorBuilders.ColorProp

is a standout container color for key components

ColorBuilders.ColorProp

is less prominent than primary for component backgrounds

ColorBuilders.ColorProp

color provides more ways to accent and distinguish your product

ColorBuilders.ColorProp

is a tonal color to be used in containers

ColorBuilders.ColorProp

is less prominent than secondary for component backgrounds

ColorBuilders.ColorProp

is the main surface color that affect surfaces of components with large containment areas, such as Card and Button

ColorBuilders.ColorProp

is a surface color used for large containment components such Card and Button with high prominence

ColorBuilders.ColorProp

is a surface color used for large containment components such as Card and Button with low prominence

ColorBuilders.ColorProp

color that can be used to balance primary and secondary colors, or bring heightened attention to an element

ColorBuilders.ColorProp

is a tonal color to be used in containers

ColorBuilders.ColorProp

is a less prominent tertiary color that can be used to balance primary and secondary colors, or bring heightened attention to an element

Public constructors

ColorScheme

Added in 1.3.0-alpha04
ColorScheme(
    primary: ColorBuilders.ColorProp = argb(ColorTokens.PRIMARY),
    primaryDim: ColorBuilders.ColorProp = argb(ColorTokens.PRIMARY_DIM),
    primaryContainer: ColorBuilders.ColorProp = argb(ColorTokens.PRIMARY_CONTAINER),
    onPrimary: ColorBuilders.ColorProp = argb(ColorTokens.ON_PRIMARY),
    onPrimaryContainer: ColorBuilders.ColorProp = argb(ColorTokens.ON_PRIMARY_CONTAINER),
    secondary: ColorBuilders.ColorProp = argb(ColorTokens.SECONDARY),
    secondaryDim: ColorBuilders.ColorProp = argb(ColorTokens.SECONDARY_DIM),
    secondaryContainer: ColorBuilders.ColorProp = argb(ColorTokens.SECONDARY_CONTAINER),
    onSecondary: ColorBuilders.ColorProp = argb(ColorTokens.ON_SECONDARY),
    onSecondaryContainer: ColorBuilders.ColorProp = argb(ColorTokens.ON_SECONDARY_CONTAINER),
    tertiary: ColorBuilders.ColorProp = argb(ColorTokens.TERTIARY),
    tertiaryDim: ColorBuilders.ColorProp = argb(ColorTokens.TERTIARY_DIM),
    tertiaryContainer: ColorBuilders.ColorProp = argb(ColorTokens.TERTIARY_CONTAINER),
    onTertiary: ColorBuilders.ColorProp = argb(ColorTokens.ON_TERTIARY),
    onTertiaryContainer: ColorBuilders.ColorProp = argb(ColorTokens.ON_TERTIARY_CONTAINER),
    surfaceContainerLow: ColorBuilders.ColorProp = argb(ColorTokens.SURFACE_CONTAINER_LOW),
    surfaceContainer: ColorBuilders.ColorProp = argb(ColorTokens.SURFACE_CONTAINER),
    surfaceContainerHigh: ColorBuilders.ColorProp = argb(ColorTokens.SURFACE_CONTAINER_HIGH),
    onSurface: ColorBuilders.ColorProp = argb(ColorTokens.ON_SURFACE),
    onSurfaceVariant: ColorBuilders.ColorProp = argb(ColorTokens.ON_SURFACE_VARIANT),
    outline: ColorBuilders.ColorProp = argb(ColorTokens.OUTLINE),
    outlineVariant: ColorBuilders.ColorProp = argb(ColorTokens.OUTLINE_VARIANT),
    background: ColorBuilders.ColorProp = argb(ColorTokens.BACKGROUND),
    onBackground: ColorBuilders.ColorProp = argb(ColorTokens.ON_BACKGROUND),
    error: ColorBuilders.ColorProp = argb(ColorTokens.ERROR),
    onError: ColorBuilders.ColorProp = argb(ColorTokens.ON_ERROR),
    errorContainer: ColorBuilders.ColorProp = argb(ColorTokens.ERROR_CONTAINER),
    onErrorContainer: ColorBuilders.ColorProp = argb(ColorTokens.ON_ERROR_CONTAINER)
)

Public properties

background

Added in 1.3.0-alpha04
val backgroundColorBuilders.ColorProp

color that appears behind other content

error

Added in 1.3.0-alpha04
val errorColorBuilders.ColorProp

color that indicates remove, delete, close or dismiss actions. Added as an errorContainer alternative that is slightly less alarming and urgent color.

errorContainer

Added in 1.3.0-alpha04
val errorContainerColorBuilders.ColorProp

is color that indicates errors or emergency actions, such as safety alerts. This color is for use-cases that are more alarming and urgent than the error color.

onBackground

Added in 1.3.0-alpha04
val onBackgroundColorBuilders.ColorProp

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

onError

Added in 1.3.0-alpha04
val onErrorColorBuilders.ColorProp

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

onErrorContainer

Added in 1.3.0-alpha04
val onErrorContainerColorBuilders.ColorProp

is color used for text and icons on the errorContainer color

onPrimary

Added in 1.3.0-alpha04
val onPrimaryColorBuilders.ColorProp

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

onPrimaryContainer

Added in 1.3.0-alpha04
val onPrimaryContainerColorBuilders.ColorProp

color (and state variants) that should be used for content on top of primaryContainer

onSecondary

Added in 1.3.0-alpha04
val onSecondaryColorBuilders.ColorProp

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

onSecondaryContainer

Added in 1.3.0-alpha04
val onSecondaryContainerColorBuilders.ColorProp

color (and state variants) should be used for content on top of secondaryContainer

onSurface

Added in 1.3.0-alpha04
val onSurfaceColorBuilders.ColorProp

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

onSurfaceVariant

Added in 1.3.0-alpha04
val onSurfaceVariantColorBuilders.ColorProp

is the color for secondary text and icons on top of surfaceContainer

onTertiary

Added in 1.3.0-alpha04
val onTertiaryColorBuilders.ColorProp

color is used for text and icons displayed on top of the tertiary color

onTertiaryContainer

Added in 1.3.0-alpha04
val onTertiaryContainerColorBuilders.ColorProp

color (and state variants) that should be used for content on top of tertiaryContainer

outline

Added in 1.3.0-alpha04
val outlineColorBuilders.ColorProp

is the main color for primary outline components. The outline color role adds contrast for accessibility purposes.

outlineVariant

Added in 1.3.0-alpha04
val outlineVariantColorBuilders.ColorProp

is the secondary color for secondary outline components

primary

Added in 1.3.0-alpha04
val primaryColorBuilders.ColorProp

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

primaryContainer

Added in 1.3.0-alpha04
val primaryContainerColorBuilders.ColorProp

is a standout container color for key components

primaryDim

Added in 1.3.0-alpha04
val primaryDimColorBuilders.ColorProp

is less prominent than primary for component backgrounds

secondary

Added in 1.3.0-alpha04
val secondaryColorBuilders.ColorProp

color provides more ways to accent and distinguish your product

secondaryContainer

Added in 1.3.0-alpha04
val secondaryContainerColorBuilders.ColorProp

is a tonal color to be used in containers

secondaryDim

Added in 1.3.0-alpha04
val secondaryDimColorBuilders.ColorProp

is less prominent than secondary for component backgrounds

surfaceContainer

Added in 1.3.0-alpha04
val surfaceContainerColorBuilders.ColorProp

is the main surface color that affect surfaces of components with large containment areas, such as Card and Button

surfaceContainerHigh

Added in 1.3.0-alpha04
val surfaceContainerHighColorBuilders.ColorProp

is a surface color used for large containment components such Card and Button with high prominence

surfaceContainerLow

Added in 1.3.0-alpha04
val surfaceContainerLowColorBuilders.ColorProp

is a surface color used for large containment components such as Card and Button with low prominence

tertiary

Added in 1.3.0-alpha04
val tertiaryColorBuilders.ColorProp

color that can be used to balance primary and secondary colors, or bring heightened attention to an element

tertiaryContainer

Added in 1.3.0-alpha04
val tertiaryContainerColorBuilders.ColorProp

is a tonal color to be used in containers

tertiaryDim

Added in 1.3.0-alpha04
val tertiaryDimColorBuilders.ColorProp

is a less prominent tertiary color that can be used to balance primary and secondary colors, or bring heightened attention to an element