Class CSSColor
java.lang.Object
com.codename1.ui.CSSColor
Parses the CSS color forms into a packed 0xAARRGGBB integer: #rgb,
#rgba, #rrggbb, #rrggbbaa, rgb(...) / rgba(...) with integer or
percentage components, and the CSS named-color subset.
This is the single home for CSS color-string parsing in the framework. The runtime CSS gradient parser and the vector map style engine both delegate here so the grammar -- and the named-color table -- lives in exactly one place.
-
Method Summary
Modifier and TypeMethodDescriptionstatic intParses a CSS color string into0xAARRGGBB, throwingIllegalArgumentExceptionwhen the value is not a recognised color so the caller can choose between a default and a propagated failure.static intParses a CSS color string into0xAARRGGBB, returningdefaultColorwhen the value isnullor not a recognised color.
-
Method Details
-
parse
Parses a CSS color string into0xAARRGGBB, throwingIllegalArgumentExceptionwhen the value is not a recognised color so the caller can choose between a default and a propagated failure. -
parse
Parses a CSS color string into0xAARRGGBB, returningdefaultColorwhen the value isnullor not a recognised color. The lenient variant for styling input that should degrade gracefully rather than fail.
-