Skip to content

Instantly share code, notes, and snippets.

@Spikeysanju
Created May 12, 2021 11:28
Show Gist options
  • Save Spikeysanju/bb9ab8f003efcf1fb3343d7fcbea92c3 to your computer and use it in GitHub Desktop.
Save Spikeysanju/bb9ab8f003efcf1fb3343d7fcbea92c3 to your computer and use it in GitHub Desktop.
UI Tips βœ…: You don't need multiple colours to make beautiful gradient!. Pick any vibrant colour & At One side reduce pass through to 0.4 - 0.7f. Now you will get Eye-Pleasing Gradients 😍
@Composable
fun GradientLogoWithText(source: String, color: Color) {
val gradientBrush = Brush.linearGradient(listOf(color, color.copy(.7f)))
Box(
modifier = Modifier
.size(80.dp)
.padding(start = 12.dp, top = 12.dp, end = 12.dp, bottom = 12.dp)
.clip(CircleShape)
.background(brush = gradientBrush)
) {
Text(
text = source.first().toString(),
color = white,
style = typography.subtitle1,
textAlign = TextAlign.Center,
modifier = Modifier.align(Alignment.Center)
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment