Class Color

    • Constructor Detail

      • Color

        public Color​(CharSequence color)
        Creates a new color with the given representation. Use static factory methods for better semantics.
        Parameters:
        color - String representation of the color.
    • Method Detail

      • custom

        public static Color custom​(CharSequence color)
        Creates a custom color.
        Parameters:
        color - Custom color.
        Returns:
        A color with the given text.
      • hsv

        public static Color hsv​(double hue,
                                double saturation,
                                double value)
        Creates an HSV color.
        Parameters:
        hue - Hue part of the color, in the range [0, 1].
        saturation - Saturation part of the color, in the range [0, 1].
        value - Value part of the color, in the range [0, 1].
        Returns:
        A color with the given values.
      • hsv

        public static Color hsv​(long hsv)
        Creates an HSV color.
        Parameters:
        hsv - HSV value of the color, use 0x...... number literals!
        Returns:
        A color with the given values.
      • hsv

        public static Color hsv​(long hue,
                                long saturation,
                                long value)
        Creates an HSV color.
        Parameters:
        hue - Hue part of the color, in the range [0, 255].
        saturation - Saturation part of the color, in the range [0, 255].
        value - Value part of the color, in the range [0, 255].
        Returns:
        A color with the given values.
      • hsva

        public static Color hsva​(double hue,
                                 double saturation,
                                 double value,
                                 double alpha)
        Creates an HSVA color.
        Parameters:
        hue - Hue part of the color, in the range [0, 1].
        saturation - Saturation part of the color, in the range [0, 1].
        value - Value part of the color, in the range [0, 1].
        alpha - Alpha part of the color, in the range [0, 1].
        Returns:
        A color with the given values.
      • hsva

        public static Color hsva​(long hsva)
        Creates an HSVA color.
        Parameters:
        hsva - HSVA value of the color, use 0x...... number literals!
        Returns:
        A color with the given values.
      • hsva

        public static Color hsva​(long hue,
                                 long saturation,
                                 long value,
                                 long alpha)
        Creates an HSVA color.
        Parameters:
        hue - Hue part of the color, in the range [0, 255].
        saturation - Saturation part of the color, in the range [0, 255].
        value - Value part of the color, in the range [0, 255].
        alpha - Alpha part of the color, in the range [0, 255].
        Returns:
        A color with the given values.
      • rgb

        public static Color rgb​(double red,
                                double green,
                                double blue)
        Creates an RGB color.
        Parameters:
        red - Red part of the color, in the range [0, 1].
        green - Green part of the color, in the range [0, 1].
        blue - Blue part of the color, in the range [0, 1].
        Returns:
        A color with the given values.
      • rgb

        public static Color rgb​(long rgb)
        Creates an RGB color.
        Parameters:
        rgb - RGB value of the color, use 0x...... number literals!
        Returns:
        A color with the given values.
      • rgb

        public static Color rgb​(long red,
                                long green,
                                long blue)
        Creates an RGB color.
        Parameters:
        red - Red part of the color, in the range [0, 255].
        green - Green part of the color, in the range [0, 255].
        blue - Blue part of the color, in the range [0, 255].
        Returns:
        A color with the given values.
      • rgba

        public static Color rgba​(double red,
                                 double green,
                                 double blue,
                                 double alpha)
        Creates an RGBA color.
        Parameters:
        red - Red part of the color, in the range [0, 1].
        green - Green part of the color, in the range [0, 1].
        blue - Blue part of the color, in the range [0, 1].
        alpha - Alpha part of the color, in the range [0, 1].
        Returns:
        A color with the given values.
      • rgba

        public static Color rgba​(long rgba)
        Creates an RGBA color.
        Parameters:
        rgba - RGBA value of the color, use 0x...... number literals!
        Returns:
        A color with the given values.
      • rgba

        public static Color rgba​(long red,
                                 long green,
                                 long blue,
                                 long alpha)
        Creates an RGBA color.
        Parameters:
        red - Red part of the color, in the range [0, 255].
        green - Green part of the color, in the range [0, 255].
        blue - Blue part of the color, in the range [0, 255].
        alpha - Alpha part of the color, in the range [0, 255].
        Returns:
        A color with the given values.
      • svg

        public static Color svg​(EColorSchemeSvg color)
        Uses a color from the SVG color scheme.
        Parameters:
        color - Color to use.
        Returns:
        A color with the given values.
      • x11

        public static Color x11​(EColorSchemeX11 color)
        Uses a color from the X11 color scheme.
        Parameters:
        color - Color to use.
        Returns:
        A color with the given values.
      • rgba

        public static Color rgba​(long rgb,
                                 double alpha)
        Creates a new color from the given RGB pair and with the given alpha value.
        Parameters:
        rgb - RGB part of the color, e.g. 0xFF337F.
        alpha - Alpha part of the color, in the range [0, 255].
        Returns:
        A color with the given values.
      • equals

        public final boolean equals​(Object obj)
        Overrides:
        equals in class Object
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class Object
      • charAt

        public default char charAt​(int index)
        Specified by:
        charAt in interface CharSequence