ColorScheme
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( |
Public methods |
|
|---|---|
final @NonNull LayoutColor |
color that appears behind other content |
final @NonNull LayoutColor |
getError()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 that indicates high priority 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 |
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 |
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 |
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 |
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 |
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 |
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
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 errorDim,
@NonNull LayoutColor errorContainer,
@NonNull LayoutColor onError,
@NonNull LayoutColor onErrorContainer
)
Public methods
getBackground
public final @NonNull LayoutColor getBackground()
color that appears behind other content
getError
public final @NonNull LayoutColor getError()
color that indicates remove, delete, close or dismiss actions. Added as a slightly less alarming and urgent alternative to errorContainer than the errorDim color
getErrorContainer
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.
getErrorDim
public final @NonNull LayoutColor getErrorDim()
color that indicates high priority errors or emergency actions, such as safety alerts
getOnBackground
public final @NonNull LayoutColor getOnBackground()
color is used for text and icons displayed on top of the background color
getOnError
public final @NonNull LayoutColor getOnError()
color is used for text and icons displayed on top of the error color
getOnErrorContainer
public final @NonNull LayoutColor getOnErrorContainer()
is color used for text and icons on the errorContainer color
getOnPrimary
public final @NonNull LayoutColor getOnPrimary()
color is used for text and icons displayed on top of the primary color
getOnPrimaryContainer
public final @NonNull LayoutColor getOnPrimaryContainer()
color (and state variants) that should be used for content on top of primaryContainer
getOnSecondary
public final @NonNull LayoutColor getOnSecondary()
color is used for text and icons displayed on top of the secondary color
getOnSecondaryContainer
public final @NonNull LayoutColor getOnSecondaryContainer()
color (and state variants) should be used for content on top of secondaryContainer
getOnSurface
public final @NonNull LayoutColor getOnSurface()
color is used for text and icons displayed on top of the surface color
getOnSurfaceVariant
public final @NonNull LayoutColor getOnSurfaceVariant()
is the color for secondary text and icons on top of surfaceContainer
getOnTertiary
public final @NonNull LayoutColor getOnTertiary()
color is used for text and icons displayed on top of the tertiary color
getOnTertiaryContainer
public final @NonNull LayoutColor getOnTertiaryContainer()
color (and state variants) that should be used for content on top of tertiaryContainer
getOutline
public final @NonNull LayoutColor getOutline()
is the main color for primary outline components. The outline color role adds contrast for accessibility purposes.
getOutlineVariant
public final @NonNull LayoutColor getOutlineVariant()
is the secondary color for secondary outline components
getPrimary
public final @NonNull LayoutColor getPrimary()
is the color displayed most frequently across your app’s screens and components
getPrimaryContainer
public final @NonNull LayoutColor getPrimaryContainer()
is a standout container color for key components
getPrimaryDim
public final @NonNull LayoutColor getPrimaryDim()
is less prominent than primary for component backgrounds
getSecondary
public final @NonNull LayoutColor getSecondary()
color provides more ways to accent and distinguish your product
getSecondaryContainer
public final @NonNull LayoutColor getSecondaryContainer()
is a tonal color to be used in containers
getSecondaryDim
public final @NonNull LayoutColor getSecondaryDim()
is less prominent than secondary for component backgrounds
getSurfaceContainer
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
public final @NonNull LayoutColor getSurfaceContainerHigh()
is a surface color used for large containment components such Card and Button with high prominence
getSurfaceContainerLow
public final @NonNull LayoutColor getSurfaceContainerLow()
is a surface color used for large containment components such as Card and Button with low prominence
getTertiary
public final @NonNull LayoutColor getTertiary()
color that can be used to balance primary and secondary colors, or bring heightened attention to an element
getTertiaryContainer
public final @NonNull LayoutColor getTertiaryContainer()
is a tonal color to be used in containers
getTertiaryDim
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