MaterialTheme


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

Summary

Public properties

ColorScheme

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

Cmn
MotionScheme

Retrieves the current MotionScheme 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

colorScheme

val colorSchemeColorScheme

Retrieves the current ColorScheme 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.material3.MaterialTheme
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.sp

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

motionScheme

@ExperimentalMaterial3ExpressiveApi
val motionSchemeMotionScheme

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

shapes

val shapesShapes

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

import androidx.compose.material3.Button
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text

val shape = MaterialTheme.shapes
Button(shape = shape.small, onClick = {}) { Text("FAB with ${shape.small} shape") }

typography

val typographyTypography

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

import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text

val typography = MaterialTheme.typography
Text(text = "Headline small styled text", style = typography.headlineSmall)