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

Public methods

final @NonNull ColorBuilders.ColorProp

color that appears behind other content

final @NonNull ColorBuilders.ColorProp

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

final @NonNull ColorBuilders.ColorProp

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

final @NonNull ColorBuilders.ColorProp

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

final @NonNull ColorBuilders.ColorProp

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

final @NonNull ColorBuilders.ColorProp

is color used for text and icons on the errorContainer color

final @NonNull ColorBuilders.ColorProp

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

final @NonNull ColorBuilders.ColorProp

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

final @NonNull ColorBuilders.ColorProp

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

final @NonNull ColorBuilders.ColorProp

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

final @NonNull ColorBuilders.ColorProp

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

final @NonNull ColorBuilders.ColorProp

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

final @NonNull ColorBuilders.ColorProp

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

final @NonNull ColorBuilders.ColorProp

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

final @NonNull ColorBuilders.ColorProp

is the main color for primary outline components.

final @NonNull ColorBuilders.ColorProp

is the secondary color for secondary outline components

final @NonNull ColorBuilders.ColorProp

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

final @NonNull ColorBuilders.ColorProp

is a standout container color for key components

final @NonNull ColorBuilders.ColorProp

is less prominent than primary for component backgrounds

final @NonNull ColorBuilders.ColorProp

color provides more ways to accent and distinguish your product

final @NonNull ColorBuilders.ColorProp

is a tonal color to be used in containers

final @NonNull ColorBuilders.ColorProp

is less prominent than secondary for component backgrounds

final @NonNull ColorBuilders.ColorProp

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

final @NonNull ColorBuilders.ColorProp

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

final @NonNull ColorBuilders.ColorProp

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

final @NonNull ColorBuilders.ColorProp

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

final @NonNull ColorBuilders.ColorProp

is a tonal color to be used in containers

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

Public methods

getBackground

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp getBackground()

color that appears behind other content

getError

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp 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-alpha05
public final @NonNull ColorBuilders.ColorProp 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-alpha05
public final @NonNull ColorBuilders.ColorProp getOnBackground()

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

getOnError

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp getOnError()

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

getOnErrorContainer

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp getOnErrorContainer()

is color used for text and icons on the errorContainer color

getOnPrimary

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp getOnPrimary()

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

getOnPrimaryContainer

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp getOnPrimaryContainer()

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

getOnSecondary

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp getOnSecondary()

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

getOnSecondaryContainer

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp getOnSecondaryContainer()

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

getOnSurface

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp getOnSurface()

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

getOnSurfaceVariant

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp getOnSurfaceVariant()

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

getOnTertiary

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp getOnTertiary()

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

getOnTertiaryContainer

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp getOnTertiaryContainer()

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

getOutline

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp getOutline()

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

getOutlineVariant

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp getOutlineVariant()

is the secondary color for secondary outline components

getPrimary

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp getPrimary()

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

getPrimaryContainer

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp getPrimaryContainer()

is a standout container color for key components

getPrimaryDim

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp getPrimaryDim()

is less prominent than primary for component backgrounds

getSecondary

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp getSecondary()

color provides more ways to accent and distinguish your product

getSecondaryContainer

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp getSecondaryContainer()

is a tonal color to be used in containers

getSecondaryDim

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp getSecondaryDim()

is less prominent than secondary for component backgrounds

getSurfaceContainer

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp 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-alpha05
public final @NonNull ColorBuilders.ColorProp getSurfaceContainerHigh()

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

getSurfaceContainerLow

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp getSurfaceContainerLow()

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

getTertiary

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp 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-alpha05
public final @NonNull ColorBuilders.ColorProp getTertiaryContainer()

is a tonal color to be used in containers

getTertiaryDim

Added in 1.3.0-alpha05
public final @NonNull ColorBuilders.ColorProp getTertiaryDim()

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