package com.pixelized.biblib.ui.composable

import androidx.compose.material.LocalAbsoluteElevation
import androidx.compose.material.LocalElevationOverlay
import androidx.compose.material.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.Dp

@Composable
fun colorElevation(
    base: Color = MaterialTheme.colors.surface,
    elevation: Dp,
): Color {
    val localElevation = LocalElevationOverlay.current
    val absoluteElevation = LocalAbsoluteElevation.current
    return localElevation?.apply(color = base, elevation = absoluteElevation + elevation) ?: base
}