Enable CSS colored text
mainBy default, CSS color properties are ignored to respect the Compose theme. To enable support for foreground (color) and background (background, background-color) CSS properties, set isTextColorEnabled = true in your HtmlStyle.
Supported Formats:
- All CSS level 4 named colors (case insensitive).
- Hexadecimal RGB (
#RRGGBB,#RRGGBBAA,#RGB,#RGBA).
Note: rgb(...), rgba(...), hsl(...), and hsla(...) are not supported. If a color is defined on a link, it overrides the textLinkStyles color.
Supported Inline Tags: span, strong, b, em, cite, dfn, i, big, small, tt, code, a, u, del, s, strike, sup, sub.
val convertedText = remember(html) {
htmlToAnnotatedString(
html,
style = HtmlStyle(isTextColorEnabled = true)
)
}
Text(text = convertedText)