MaterialTheme

object 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.

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.

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

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.Text

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