Lilly
08/04/2023, 11:22 AMMaterialTheme.colorScheme
from non-composable?
@Stable
val largeRadialGradient = object : ShaderBrush() {
override fun createShader(size: Size): Shader {
val biggerDimension = maxOf(size.height, size.width)
return RadialGradientShader(
colors = listOf(
MaterialTheme.colorScheme.primary,... // access colorScheme here
),
center = size.center,
radius = biggerDimension,
colorStops = listOf(
0f,
0.5f,
0.8f,
),
)
}
}
Corey
08/04/2023, 12:26 PMcolorScheme
is a @Composable
then noLilly
08/04/2023, 12:27 PMVlad
08/04/2023, 12:31 PMstaticCompositionLocalOf
so you can access it only inisde the tree.
But well, the Colour itself is not Composable so If you save it additionally somewhere, you can get if from thereStylianos Gakis
08/04/2023, 12:54 PMLilly
08/04/2023, 5:13 PMBrush.radialGradient()
which is satisfying too