@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,
),
)
}
}
c
Corey
08/04/2023, 12:26 PM
@Lilly if
colorScheme
is a
@Composable
then no
l
Lilly
08/04/2023, 12:27 PM
Obvious, but the color scheme can be accessed in another way, I guess
v
Vlad
08/04/2023, 12:31 PM
MaterialTheme gets colorScheme through
Copy code
staticCompositionLocalOf
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 there