MaterialTheme


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

Summary

Public properties

Colors

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

Cmn
Shapes

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

Cmn
Typography

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

Cmn

Public properties

colors

val colorsColors

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

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material.MaterialTheme
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.sp

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

shapes

val shapesShapes

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

typography

val typographyTypography

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

import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text

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