Colors and MaterialTheme
Apply consistent theming.
Colors in Compose
Compose represents colors with the Color class. There are ready-made values like Color.Red and Color.Blue.
You pass a Color to parameters such as a Text color or a background.
Text(
text = "Hi",
color = Color.Blue
)Custom Color Values
Make any color from a hex code using Color(0xFFRRGGBB). The first two digits, FF, mean fully opaque.
For example, 0xFF6200EE is a purple.
val purple = Color(0xFF6200EE)
Text("Brand", color = purple)All lessons in this course
- Styling Text
- Buttons and Clicks
- Spacing with Padding
- Colors and MaterialTheme