Package de.xima.fc.common.graphdot
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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Color(CharSequence color)
Creates a new color with the given representation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Default Methods Modifier and Type Method Description default char
charAt(int index)
default IntStream
chars()
default IntStream
codePoints()
static Color
custom(CharSequence color)
Creates a custom color.boolean
equals(Object obj)
int
hashCode()
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
length()
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
svg(EColorSchemeSvg color)
Uses a color from the SVG color scheme.String
toString()
static Color
x11(EColorSchemeX11 color)
Uses a color from the X11 color scheme.
-
-
-
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
-
toString
public String toString()
- Specified by:
toString
in interfaceCharSequence
-
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, use0x......
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, use0x......
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, use0x......
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, use0x......
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.
-
charAt
public default char charAt(int index)
- Specified by:
charAt
in interfaceCharSequence
-
chars
public default IntStream chars()
- Specified by:
chars
in interfaceCharSequence
-
codePoints
public default IntStream codePoints()
- Specified by:
codePoints
in interfaceCharSequence
-
length
public default int length()
- Specified by:
length
in interfaceCharSequence
-
subSequence
public default CharSequence subSequence(int start, int end)
- Specified by:
subSequence
in interfaceCharSequence
-
-