public final 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(
    @NonNull LayoutColor primary,
    @NonNull LayoutColor primaryDim,
    @NonNull LayoutColor primaryContainer,
    @NonNull LayoutColor onPrimary,
    @NonNull LayoutColor onPrimaryContainer,
    @NonNull LayoutColor secondary,
    @NonNull LayoutColor secondaryDim,
    @NonNull LayoutColor secondaryContainer,
    @NonNull LayoutColor onSecondary,
    @NonNull LayoutColor onSecondaryContainer,
    @NonNull LayoutColor tertiary,
    @NonNull LayoutColor tertiaryDim,
    @NonNull LayoutColor tertiaryContainer,
    @NonNull LayoutColor onTertiary,
    @NonNull LayoutColor onTertiaryContainer,
    @NonNull LayoutColor surfaceContainerLow,
    @NonNull LayoutColor surfaceContainer,
    @NonNull LayoutColor surfaceContainerHigh,
    @NonNull LayoutColor onSurface,
    @NonNull LayoutColor onSurfaceVariant,
    @NonNull LayoutColor outline,
    @NonNull LayoutColor outlineVariant,
    @NonNull LayoutColor background,
    @NonNull LayoutColor onBackground,
    @NonNull LayoutColor error,
    @NonNull LayoutColor onError,
    @NonNull LayoutColor errorContainer,
    @NonNull LayoutColor onErrorContainer
)

Public methods

final @NonNull LayoutColor

color that appears behind other content

final @NonNull LayoutColor

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

final @NonNull LayoutColor

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

final @NonNull LayoutColor

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

final @NonNull LayoutColor

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

final @NonNull LayoutColor

is color used for text and icons on the errorContainer color

final @NonNull LayoutColor

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

final @NonNull LayoutColor

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

final @NonNull LayoutColor

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

final @NonNull LayoutColor

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

final @NonNull LayoutColor

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

final @NonNull LayoutColor

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

final @NonNull LayoutColor

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

final @NonNull LayoutColor

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

final @NonNull LayoutColor

is the main color for primary outline components.

final @NonNull LayoutColor

is the secondary color for secondary outline components

final @NonNull LayoutColor

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

final @NonNull LayoutColor

is a standout container color for key components

final @NonNull LayoutColor

is less prominent than primary for component backgrounds

final @NonNull LayoutColor

color provides more ways to accent and distinguish your product

final @NonNull LayoutColor

is a tonal color to be used in containers

final @NonNull LayoutColor

is less prominent than secondary for component backgrounds

final @NonNull LayoutColor

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

final @NonNull LayoutColor

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

final @NonNull LayoutColor

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

final @NonNull LayoutColor

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

final @NonNull LayoutColor

is a tonal color to be used in containers

final @NonNull LayoutColor

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-alpha06
public ColorScheme(
    @NonNull LayoutColor primary,
    @NonNull LayoutColor primaryDim,
    @NonNull LayoutColor primaryContainer,
    @NonNull LayoutColor onPrimary,
    @NonNull LayoutColor onPrimaryContainer,
    @NonNull LayoutColor secondary,
    @NonNull LayoutColor secondaryDim,
    @NonNull LayoutColor secondaryContainer,
    @NonNull LayoutColor onSecondary,
    @NonNull LayoutColor onSecondaryContainer,
    @NonNull LayoutColor tertiary,
    @NonNull LayoutColor tertiaryDim,
    @NonNull LayoutColor tertiaryContainer,
    @NonNull LayoutColor onTertiary,
    @NonNull LayoutColor onTertiaryContainer,
    @NonNull LayoutColor surfaceContainerLow,
    @NonNull LayoutColor surfaceContainer,
    @NonNull LayoutColor surfaceContainerHigh,
    @NonNull LayoutColor onSurface,
    @NonNull LayoutColor onSurfaceVariant,
    @NonNull LayoutColor outline,
    @NonNull LayoutColor outlineVariant,
    @NonNull LayoutColor background,
    @NonNull LayoutColor onBackground,
    @NonNull LayoutColor error,
    @NonNull LayoutColor onError,
    @NonNull LayoutColor errorContainer,
    @NonNull LayoutColor onErrorContainer
)

Public methods

getBackground

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getBackground()

color that appears behind other content

getError

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getError()

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

getErrorContainer

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getErrorContainer()

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.

getOnBackground

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getOnBackground()

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

getOnError

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getOnError()

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

getOnErrorContainer

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getOnErrorContainer()

is color used for text and icons on the errorContainer color

getOnPrimary

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getOnPrimary()

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

getOnPrimaryContainer

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getOnPrimaryContainer()

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

getOnSecondary

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getOnSecondary()

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

getOnSecondaryContainer

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getOnSecondaryContainer()

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

getOnSurface

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getOnSurface()

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

getOnSurfaceVariant

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getOnSurfaceVariant()

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

getOnTertiary

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getOnTertiary()

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

getOnTertiaryContainer

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getOnTertiaryContainer()

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

getOutline

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getOutline()

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

getOutlineVariant

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getOutlineVariant()

is the secondary color for secondary outline components

getPrimary

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getPrimary()

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

getPrimaryContainer

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getPrimaryContainer()

is a standout container color for key components

getPrimaryDim

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getPrimaryDim()

is less prominent than primary for component backgrounds

getSecondary

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getSecondary()

color provides more ways to accent and distinguish your product

getSecondaryContainer

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getSecondaryContainer()

is a tonal color to be used in containers

getSecondaryDim

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getSecondaryDim()

is less prominent than secondary for component backgrounds

getSurfaceContainer

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getSurfaceContainer()

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

getSurfaceContainerHigh

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getSurfaceContainerHigh()

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

getSurfaceContainerLow

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getSurfaceContainerLow()

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

getTertiary

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getTertiary()

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

getTertiaryContainer

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getTertiaryContainer()

is a tonal color to be used in containers

getTertiaryDim

Added in 1.3.0-alpha06
public final @NonNull LayoutColor getTertiaryDim()

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