Google は、黒人コミュニティに対する人種平等の促進に取り組んでいます。取り組みを見る

Colors

@Stable class Colors
kotlin.Any
   ↳ androidx.compose.material.Colors

Collection of colors in the Material color specification

To create a light set of colors using the baseline values, use lightColors To create a dark set of colors using the baseline values, use darkColors

Summary

Public constructors
<init>(primary: Color, primaryVariant: Color, secondary: Color, secondaryVariant: Color, background: Color, surface: Color, error: Color, onPrimary: Color, onSecondary: Color, onBackground: Color, onSurface: Color, onError: Color, isLight: Boolean)

Collection of colors in the Material color specification

Public methods
Colors
copy(primary: Color = this.primary, primaryVariant: Color = this.primaryVariant, secondary: Color = this.secondary, secondaryVariant: Color = this.secondaryVariant, background: Color = this.background, surface: Color = this.surface, error: Color = this.error, onPrimary: Color = this.onPrimary, onSecondary: Color = this.onSecondary, onBackground: Color = this.onBackground, onSurface: Color = this.onSurface, onError: Color = this.onError, isLight: Boolean = this.isLight)

Returns a copy of this Colors, optionally overriding some of the values.

String

Extension functions
From androidx.compose.material
Color

Tries to match color to a color in this Colors, and then returns the corresponding on color.

Properties
Color

The background color appears behind scrollable content.

Color

The error color is used to indicate error within components, such as text fields.

Boolean

Whether this Colors is considered as a 'light' or 'dark' set of colors.

Color

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

Color

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

Color

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

Color

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

Color

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

Color

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

Color

The primary variant color is used to distinguish two elements of the app using the primary color, such as the top app bar and the system bar.

Color

The secondary color provides more ways to accent and distinguish your product.

Color

The secondary variant color is used to distinguish two elements of the app using the secondary color.

Color

The surface color is used on surfaces of components, such as cards, sheets and menus.

Extension properties
From androidx.compose.material
Color

primarySurface represents the background color of components that are Colors.primary in light theme, and Colors.surface in dark theme, such as androidx.compose.material.TabRow and androidx.compose.material.TopAppBar.

Public constructors

<init>

Colors(
    primary: Color,
    primaryVariant: Color,
    secondary: Color,
    secondaryVariant: Color,
    background: Color,
    surface: Color,
    error: Color,
    onPrimary: Color,
    onSecondary: Color,
    onBackground: Color,
    onSurface: Color,
    onError: Color,
    isLight: Boolean)

Collection of colors in the Material color specification

To create a light set of colors using the baseline values, use lightColors To create a dark set of colors using the baseline values, use darkColors

Public methods

copy

fun copy(
    primary: Color = this.primary,
    primaryVariant: Color = this.primaryVariant,
    secondary: Color = this.secondary,
    secondaryVariant: Color = this.secondaryVariant,
    background: Color = this.background,
    surface: Color = this.surface,
    error: Color = this.error,
    onPrimary: Color = this.onPrimary,
    onSecondary: Color = this.onSecondary,
    onBackground: Color = this.onBackground,
    onSurface: Color = this.onSurface,
    onError: Color = this.onError,
    isLight: Boolean = this.isLight
): Colors

Returns a copy of this Colors, optionally overriding some of the values.

toString

fun toString(): String

Properties

background

var background: Color

The background color appears behind scrollable content.

error

var error: Color

The error color is used to indicate error within components, such as text fields.

isLight

var isLight: Boolean

Whether this Colors is considered as a 'light' or 'dark' set of colors. This affects default behavior for some components: for example, in a light theme a TopAppBar will use primary by default for its background color, when in a dark theme it will use surface.

onBackground

var onBackground: Color

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

onError

var onError: Color

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

onPrimary

var onPrimary: Color

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

onSecondary

var onSecondary: Color

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

onSurface

var onSurface: Color

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

primary

var primary: Color

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

primaryVariant

var primaryVariant: Color

The primary variant color is used to distinguish two elements of the app using the primary color, such as the top app bar and the system bar.

secondary

var secondary: Color

The secondary color provides more ways to accent and distinguish your product. Secondary colors are best for:

  • Floating action buttons
  • Selection controls, like checkboxes and radio buttons
  • Highlighting selected text
  • Links and headlines

secondaryVariant

var secondaryVariant: Color

The secondary variant color is used to distinguish two elements of the app using the secondary color.

surface

var surface: Color

The surface color is used on surfaces of components, such as cards, sheets and menus.