OudsColoredBox
fun OudsColoredBox(color: OudsColorKeyToken.Surface, modifier: Modifier = Modifier, contentAlignment: Alignment = Alignment.TopStart, propagateMinConstraints: Boolean = false, content: @Composable BoxScope.() -> Unit)
An OUDS colored box is a Box where content color is automatically adjusted to maximize the contrast with the chosen background color.
Moreover, the colors of several OUDS components (for instance OudsButton) are also automatically adjusted. Some tokens associated with these colors can be customized and are identified with the Mono
suffix (for instance colorBgDefaultEnabledMono
in OudsButtonTokens
).
Parameters
color
The background color.
modifier
Modifier to be applied to the layout corresponding to the colored box.
contentAlignment
The default alignment inside the colored box.
propagateMinConstraints
Whether the incoming min constraints should be passed to content.
content
The content of this colored box.
Samples
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import com.orange.ouds.core.component.coloredbox.OudsColoredBox
import com.orange.ouds.theme.tokens.OudsColorKeyToken
fun main() {
//sampleStart
OudsColoredBox(color = OudsColorKeyToken.Surface.Status.Info.Emphasized) {
// From this point LocalContentColor is automatically adjusted to maximize the contrast with OudsColorKeyToken.Surface.Status.Info.Emphasized
Text("Text")
}
//sampleEnd
}