ColorScheme
Class
Android
class ColorScheme(
primary: Color,
onPrimary: Color,
primaryContainer: Color,
onPrimaryContainer: Color,
inversePrimary: Color,
secondary: Color,
onSecondary: Color,
secondaryContainer: Color,
onSecondaryContainer: Color,
tertiary: Color,
onTertiary: Color,
tertiaryContainer: Color,
onTertiaryContainer: Color,
background: Color,
onBackground: Color,
surface: Color,
onSurface: Color,
surfaceVariant: Color,
onSurfaceVariant: Color,
surfaceTint: Color,
inverseSurface: Color,
inverseOnSurface: Color,
error: Color,
onError: Color,
errorContainer: Color,
onErrorContainer: Color,
border: Color,
borderVariant: Color,
scrim: 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
(https://m3.material.io/styles/color/overview).
- Floating action buttons
- Selection controls, like checkboxes and radio buttons
- Highlighting selected text
- Links and headlines
Properties
Android
var primary
Android
var onPrimary
Android
var primaryContainer
Android
var onPrimaryContainer
Android
var inversePrimary
Android
var secondary
Android
var onSecondary
Android
var secondaryContainer
Android
var onSecondaryContainer
Android
var tertiary
Android
var onTertiary
Android
var tertiaryContainer
Android
var onTertiaryContainer
Android
var background
Android
var onBackground
Android
var surface
Android
var onSurface
Android
var surfaceVariant
Android
var onSurfaceVariant
Android
var surfaceTint
Android
var inverseSurface
Android
var inverseOnSurface
Android
var error
Android
var onError
Android
var errorContainer
Android
var onErrorContainer
Android
var border
Android
var borderVariant
Android
var scrim
Functions
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,
border: Color = this.border,
borderVariant: Color = this.borderVariant,
scrim: Color = this.scrim
): ColorScheme
Returns a copy of this ColorScheme, optionally overriding some of the values.