Theme
Documentation of the dev.medzik.android.compose.theme
package.
Custom color schemas
Name | Preview |
---|---|
successContainer | |
infoContainer | |
warningContainer |
@Composable
fun PreviewContainer() {
Surface(
color = MaterialTheme.colorScheme.successContainer, // infoContainer, warningContainer
shape = MaterialTheme.shapes.large
) {
Spacer(
modifier = Modifier.padding(horizontal = 30.dp, vertical = 15.dp)
)
}
}
combineAlpha
The combineAlpha(alpha: Float)
function returns a new color multiplied by the alpha value.
See the alpha section for examples.
Alpha
Name | Preview |
---|---|
NormalAlpha | |
DisabledAlpha |
@Composable
private fun PreviewContainer() {
Surface(
color = MaterialTheme.colorScheme.successContainer.combineAlpha(NormalAlpha), // DisabledAlpha
shape = MaterialTheme.shapes.large
) {
Spacer(
modifier = Modifier.padding(horizontal = 30.dp, vertical = 15.dp)
)
}
}
isDark
The MaterialTheme.colorScheme.isDark
returns true
if the background color is dark, false
otherwise.
@Composable
private fun Example() {
val color = if (MaterialTheme.colorScheme.isDark) Color.White else Color.Black
// ..
}