withColor
inline fun <R : Any> OudsAnnotatedString.ColorBuilder.withColor(color: Color, block: OudsAnnotatedString.ColorBuilder.() -> R): R
DSL helper for applying color to a block of text.
This is the recommended way to add colored text as it automatically manages the annotation stack.
Example:
buildOudsAnnotatedHeadingText {
append("This is ")
withColor(OudsTheme.colorScheme.content.brandSecondary) {
append("brand secondary text")
}
}Content copied to clipboard
Return
The result of the block.
Parameters
color
The color to apply to the text.
block
The lambda that appends the text to be colored.