Gradients

 



Creating a great background gradient for your UI is easy with https://cssgradient.io.

This site will let you play with color hex codes and stop values to get your UI just right. It will also generate the CSS code for you if you are using this gradient for a website.

For the above login Android app, the background is composed of a linear gradient with three color values (#00D4FF, #097959, #020024 specifically). These colors represent the gradient's start, middle, and end color. In Compose, you would set this background with the following code within a modifier inside a column (or any composable that you want to set a background color).

Login.kt

Column(
modifier = Modifier
.fillMaxSize()
.background(
brush = Brush.linearGradient(
0.0f to ThemeGradientStart,
0.5f to ThemeGradientMid,
0.7f to ThemeGradientEnd
)
)


The variables ThemeGradientStart, ThemeGradientMid, and ThemeGradientEnd are set in your Color.kt file.


Color.kt

val ThemeGradientStart = Color(0xFF00D4FF)
val ThemeGradientMid = Color(0xFF097959)
val ThemeGradientEnd = Color(0xFF020024)

Try the website and make your own!

https://cssgradient.io

Code for the entire app can be found at https://github.com/PopularPenguin/Compose-Login in the UI branch.

Happy coding!

Comments

Popular posts from this blog

Permissions in Jetpack Compose

Jetpack Compose Login UI

Card Animations in Jetpack Compose