InAppColorParser

Parses the CSS hex forms #RGB, #RGBA, #RRGGBB, #RRGGBBAA into an ARGB Int. The leading # is mandatory (matches what the native-rich-media preview renders); anything else — a bare hex string, a bad length, non-hex characters, empty or null — returns null so the strict parser can reject the whole config.

Not Color.parseColor: that throws on #RGB/#RGBA, rejects #RRGGBBAA, and is awkward to guard. toLong(16) here requires the whole string to be valid hex.

Functions

Link copied to clipboard
fun parse(hex: String?): Int?