Class Color

java.lang.Object
de.xima.fc.common.graphdot.Color
All Implemented Interfaces:
Serializable, CharSequence

public final class Color extends Object
A single color for graphviz.
indianred
#ff0033
0.345,0.500.0.250
Since:
8.2.0
Author:
XIMA MEDIA GmbH
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new color with the given representation.
  • Method Summary

    Modifier and Type
    Method
    Description
    default char
    charAt(int index)
     
    default IntStream
     
    default IntStream
     
    static Color
    Creates a custom color.
    final boolean
     
    final int
     
    static Color
    hsv(double hue, double saturation, double value)
    Creates an HSV color.
    static Color
    hsv(long hsv)
    Creates an HSV color.
    static Color
    hsv(long hue, long saturation, long value)
    Creates an HSV color.
    static Color
    hsva(double hue, double saturation, double value, double alpha)
    Creates an HSVA color.
    static Color
    hsva(long hsva)
    Creates an HSVA color.
    static Color
    hsva(long hue, long saturation, long value, long alpha)
    Creates an HSVA color.
    default int
     
    static Color
    rgb(double red, double green, double blue)
    Creates an RGB color.
    static Color
    rgb(long rgb)
    Creates an RGB color.
    static Color
    rgb(long red, long green, long blue)
    Creates an RGB color.
    static Color
    rgba(double red, double green, double blue, double alpha)
    Creates an RGBA color.
    static Color
    rgba(long rgba)
    Creates an RGBA color.
    static Color
    rgba(long rgb, double alpha)
    Creates a new color from the given RGB pair and with the given alpha value.
    static Color
    rgba(long red, long green, long blue, long alpha)
    Creates an RGBA color.
    default CharSequence
    subSequence(int start, int end)
     
    static Color
    Uses a color from the SVG color scheme.
     
    static Color
    Uses a color from the X11 color scheme.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • 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 Details

    • toString

      public String toString()
      Specified by:
      toString in interface CharSequence
    • 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

      default char charAt(int index)
      Specified by:
      charAt in interface CharSequence
    • chars

      default IntStream chars()
      Specified by:
      chars in interface CharSequence
    • codePoints

      default IntStream codePoints()
      Specified by:
      codePoints in interface CharSequence
    • length

      default int length()
      Specified by:
      length in interface CharSequence
    • subSequence

      default CharSequence subSequence(int start, int end)
      Specified by:
      subSequence in interface CharSequence