java.lang.Object
io.github.palexdev.materialfx.utils.ColorUtils
Utils class for JavaFX's
Colors and CSS.-
Method Summary
Modifier and TypeMethodDescriptionstatic ColorGenerates a randomColorusing java.util.Random.static StringlinearGradientToString(LinearGradient gradient) Util method to convertLinearGradientto a CSS string.static StringradialGradientToString(RadialGradient gradient) Util method to convertRadialGradientto a CSS string.static StringConverts a JavaFX'sColorto CSS corresponding rgb function.static StringConverts a JavaFX'sColorto CSS corresponding rgba function.static StringstopToString(Stop stop) Properly converts aStopto string.static StringConverts a JavaFX Paint object to the right CSS string.static StringConverts the given color to a String in HSB format.static StringConverts the given color to a String in HSL format.static StringConverts the given color to a String in hexadecimal format.static StringtoWebAlpha(Color color) Converts the given color to a String in hexadecimal format, also includes the color's opacity.
-
Method Details
-
toCss
Converts a JavaFX Paint object to the right CSS string.Supports:
Color,LinearGradient,RadialGradient. -
rgb
Converts a JavaFX'sColorto CSS corresponding rgb function.- Returns:
- the rgb function as a string
-
rgba
Converts a JavaFX'sColorto CSS corresponding rgba function.- Returns:
- the rgba function as a string
-
getRandomColor
Generates a randomColorusing java.util.Random. -
linearGradientToString
Util method to convertLinearGradientto a CSS string. This is partly a copy ofLinearGradient.toString()butStopsare correctly converted for CSS.- Parameters:
gradient- the linear gradient to convert- See Also:
-
radialGradientToString
Util method to convertRadialGradientto a CSS string. This is partly a copy ofRadialGradient.toString()butStopsare correctly converted for CSS.- Parameters:
gradient- the radial gradient to convert- See Also:
-
stopToString
Properly converts aStopto string. Partly copied fromStop.toString()but the color is converted usingrgba(Color). -
toWeb
Converts the given color to a String in hexadecimal format. -
toWebAlpha
Converts the given color to a String in hexadecimal format, also includes the color's opacity. -
toHSL
Converts the given color to a String in HSL format. -
toHSB
Converts the given color to a String in HSB format.
-