Class ColorUtil


  • public class ColorUtil
    extends Object
    The utility class for Color creation and transformation.
    • Constructor Detail

      • ColorUtil

        public ColorUtil()
    • Method Detail

      • colorToInteger

        public static int colorToInteger​(Color color)
        Transforms the given Color into integer BGR notation.
      • createColor

        public static Color createColor​(org.eclipse.swt.graphics.RGB rgb)
        Creates a Color object out of the given RGB object
        Parameters:
        rgb - a RGB object to take color value from
      • createColor

        public static Color createColor​(int rgb)
        Creates a Color object from integer color notation BGR
      • createColor

        public static Color createColor​(int red,
                                        int green,
                                        int blue)
        Creates a Color object out of the given color components
      • createRGB

        public static org.eclipse.swt.graphics.RGB createRGB​(Color color)
        Creates an RGB object out of the given Color object
        Parameters:
        color - a Color object to take color value from
      • createSwtColor

        public static final org.eclipse.swt.graphics.Color createSwtColor​(org.eclipse.swt.widgets.Widget widget,
                                                                          Color color)
        Creates a new Color object with properties specified by the given color. The result must be disposed of.
        Parameters:
        widget - the widget that is going to use the color
        color - specification of the color to create
        Returns:
        Color instance; it must be disposed by the client
      • equalsByRGB

        public static boolean equalsByRGB​(Color c1,
                                          Color c2)
        Returns true if colors have equal RGB values, false otherwise.
        Parameters:
        c1 - first color to check
        c2 - second color to check
        Returns:
        true if colors have equal RGB values, false otherwise