Google is committed to advancing racial equity for Black communities. See how.

MaterialTheme

object MaterialTheme
kotlin.Any
   ↳ androidx.compose.material.MaterialTheme

Contains functions to access the current theme values provided at the call site's position in the hierarchy.

Summary

Properties
Colors

Retrieves the current Colors at the call site's position in the hierarchy.

Shapes

Retrieves the current Shapes at the call site's position in the hierarchy.

Typography

Retrieves the current Typography at the call site's position in the hierarchy.

Properties

colors

@Composable @ComposableContract(true) val colors: Colors

Retrieves the current Colors at the call site's position in the hierarchy.

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize

val colors = MaterialTheme.colors
Box(Modifier.aspectRatio(1f).fillMaxSize().background(color = colors.primary))

shapes

@Composable @ComposableContract(true) val shapes: Shapes

Retrieves the current Shapes at the call site's position in the hierarchy.

typography

@Composable @ComposableContract(true) val typography: Typography

Retrieves the current Typography at the call site's position in the hierarchy.

import androidx.compose.foundation.Text

val typography = MaterialTheme.typography
Text(text = "H4 styled text", style = typography.h4)