Class ColorUtilities


  • public class ColorUtilities
    extends Object
    An utilities class for handling colors.
    Since:
    0.7.4
    Author:
    Andrea Antonello (www.hydrologis.com)
    • Constructor Detail

      • ColorUtilities

        public ColorUtilities()
    • Method Detail

      • colorFromRbgString

        public static Color colorFromRbgString​(String rbgString)
        Converts a color string.
        Parameters:
        rbgString - the string in the form "r,g,b,a" as integer values between 0 and 255.
        Returns:
        the Color.
      • asHexWithAlpha

        public static String asHexWithAlpha​(Color color)
        Convert a color to its hex representation.
        Parameters:
        color - the color to convert.
        Returns:
        the hex.
      • asHex

        public static String asHex​(Color color)
        Convert a color to its hex representation.
        Parameters:
        color - the color to convert.
        Returns:
        the hex.
      • fromHex

        public static Color fromHex​(String hex)
        Convert hex color to Color.
        Returns:
        the Color object.
      • makeTransparent

        public static Color makeTransparent​(Color color,
                                            int alpha)
        Add alpha to a color.
        Parameters:
        color - the color to make transparent.
        Returns:
        the new color.