applyTonalElevation

Applies tonal elevation to a background color based on the current ColorScheme and elevation.

This function checks if tonal elevation is enabled and, if so, computes the surface color at the given elevation. If tonal elevation is not enabled or the background color is the same as the surface color, it returns the original background color.

Return

A Color that represents the adjusted color at the given elevation.

Parameters

backgroundColor

The Color to adjust based on elevation.

elevation

The Dp value representing the elevation for the surface.