Package net.sf.jaxodraw.util
Class JaxoColor
- java.lang.Object
-
- net.sf.jaxodraw.util.JaxoColor
-
public final class JaxoColor extends java.lang.ObjectDefinitions and conversions for the colors of the LaTeXcolordvipackage (approximately) and a predefined set of gray shades.- Since:
- 2.0
-
-
Field Summary
Fields Modifier and Type Field Description static intALL_COLORS_MODEAny Color can be chosen.static java.awt.ColorAPRICOTThe color Apricot.static java.awt.ColorAQUAMARINEThe color Aquamarine.static java.awt.ColorBITTERSWEETThe color Bittersweet.static java.awt.ColorBLACKThe color Black.static java.awt.ColorBLUEThe color Blue.static java.awt.ColorBLUE_GREENThe color BlueGreen.static java.awt.ColorBLUE_VIOLETThe color BlueViolet.static java.awt.ColorBRICK_REDThe color BrickRed.static java.awt.ColorBROWNThe color Brown.static java.awt.ColorBURNT_ORANGEThe color BurntOrange.static java.awt.ColorCADET_BLUEThe color CadetBlue.static java.awt.ColorCARNATION_PINKThe color CarnationPink.static java.awt.ColorCERULEANThe color Cerulean.static java.awt.ColorCORNFLOWER_BLUEThe color CornflowerBlue.static java.awt.ColorCYANThe color Cyan.static java.awt.ColorDANDELIONThe color Dandelion.static java.awt.ColorDARK_ORCHIDThe color DarkOrchid.static java.awt.ColorEMERALDThe color Emerald.static java.awt.ColorFOREST_GREENThe color ForestGreen.static java.awt.ColorFUCHSIAThe color Fuchsia.static java.awt.ColorGOLDEN_RODThe color Goldenrod.static java.awt.ColorGRAYThe color Gray.static java.awt.ColorGRAYSCALE105The color GrayScale105.static java.awt.ColorGRAYSCALE120The color GrayScale120.static java.awt.ColorGRAYSCALE135The color GrayScale135.static java.awt.ColorGRAYSCALE15The color GrayScale15.static java.awt.ColorGRAYSCALE150The color GrayScale150.static java.awt.ColorGRAYSCALE165The color GrayScale165.static java.awt.ColorGRAYSCALE180The color GrayScale180.static java.awt.ColorGRAYSCALE195The color GrayScale195.static java.awt.ColorGRAYSCALE210The color GrayScale210.static java.awt.ColorGRAYSCALE225The color GrayScale225.static java.awt.ColorGRAYSCALE240The color GrayScale240.static java.awt.ColorGRAYSCALE30The color GrayScale30.static java.awt.ColorGRAYSCALE45The color GrayScale45.static java.awt.ColorGRAYSCALE60The color GrayScale60.static java.awt.ColorGRAYSCALE75The color GrayScale75.static java.awt.ColorGRAYSCALE90The color GrayScale90.static java.awt.ColorGREENThe color Green.static java.awt.ColorGREEN_YELLOWThe color GreenYellow.static intJAXO_COLORS_MODEAll Colors defined in JaxoColor can be chosen.static intJAXO_COLORS_NO_GRAYSCALES_MODEColors defined in JaxoColor except grayscales can be chosen.static java.awt.ColorJUNGLE_GREENThe color JungleGreen.static java.awt.ColorLAVENDERThe color Lavender.static java.awt.ColorLIME_GREENThe color LimeGreen.static java.awt.ColorMAGENTAThe color Magenta.static java.awt.ColorMAHOGANYThe color Mahagony.static java.awt.ColorMAROONThe color Maroon.static java.awt.ColorMELONThe color Melon.static java.awt.ColorMIDNIGHT_BLUEThe color MidnightBlue.static java.awt.ColorMULBERRYThe color Mulberry.static java.awt.ColorNAVY_BLUEThe color NavyBlue.static java.awt.ColorOLIVE_GREENThe color OliveGreen.static java.awt.ColorORANGEThe color Orange.static java.awt.ColorORANGE_REDThe color OrangeRed.static java.awt.ColorORCHIDThe color Orchid.static java.awt.ColorPEACHThe color Peach.static java.awt.ColorPERIWINKLEThe color Periwinkle.static java.awt.ColorPINE_GREENThe color PineGreen.static java.awt.ColorPLUMThe color Plum.static java.awt.ColorPROCESS_BLUEThe color ProcessBlue.static java.awt.ColorPURPLEThe color Purple.static java.awt.ColorRAWSIENNAThe color RawSienna.static java.awt.ColorREDThe color Red.static java.awt.ColorRED_ORANGEThe color RedOrange.static java.awt.ColorRED_VIOLETThe color RedViolet.static java.awt.ColorRHODAMINEThe color Rhodamine.static java.awt.ColorROYAL_BLUEThe color RoyalBlue.static java.awt.ColorROYAL_PURPLEThe color RoyalPurple.static java.awt.ColorRUBINE_REDThe color RubineRed.static java.awt.ColorSALMONThe color Salmon.static java.awt.ColorSEA_GREENThe color SeaGreen.static java.awt.ColorSEPIAThe color Sepia.static java.awt.ColorSKY_BLUEThe color SkyBlue.static java.awt.ColorSPRING_GREENThe color SpringGreen.static java.awt.ColorTANThe color Tan.static java.awt.ColorTEAL_BLUEThe color TealBlue.static java.awt.ColorTHISTLEThe color Thistle.static java.awt.ColorTURQUOISEThe color Turquoise.static java.awt.ColorVIOLETThe color Violet.static java.awt.ColorVIOLET_REDThe color VioletRed.static java.awt.ColorWHITEThe color White.static java.awt.ColorWILDSTRAWBERRYThe color WildStrawberry.static java.awt.ColorYELLOWThe color Yellow.static java.awt.ColorYELLOW_GREENThe color YellowGreen.static java.awt.ColorYELLOW_ORANGEThe color YellowOrange.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.awt.ColorgetClosestColorTo(java.awt.Color refcolor, int mode)Return the Color closest (in the specified mode) to the given color.static java.awt.ColorgetColor(int i)Returns the color at index i of the colorList.static java.awt.ColorgetColor(java.lang.String cName)Returns the color corresponding to the name cName, or the default color if none.static java.awt.ColorgetColor(java.lang.String cName, int mode)Returns the color corresponding to the name cName, or the default color if none.static intgetColorCount()Returns the number of colors defined by JaxoColor.static java.lang.StringgetColorName(int i)Returns the name of the color at index i in the colorList.static java.lang.StringgetColorName(java.awt.Color color)Returns the name of the closest defined color to 'color'.static java.lang.StringgetColorName(java.awt.Color color, int space)Returns the name of the closest defined color (in the mode) color.static java.awt.ColorgetDefaultColor()Returns the current default color.static java.awt.ColorgetDefaultFillColor(java.awt.Color lineColor)Returns the current default fill color for the given line color.static java.awt.ColorgetGrayScaleColor(float f)Returns the grayscale that corresponds to the float value f.static floatgetGrayScaleFloat(java.awt.Color color)Returns a string representation of a Color that gives the grayscale of color, or sets it to '0.0' (black), if color is not a grayscale.static java.lang.StringgetLatexColorCommand(java.awt.Color color)Returns a String containing the LaTex color command (as used by the package colordvi) to set the color.static booleanisDefinedColor(java.awt.Color color)Checks whether the given color is a defined Color.static booleanisDefinedColor(java.awt.Color color, int mode)Checks whether the given color is a defined Color in the given mode.static booleanisDefinedColorName(java.lang.String cName)Checks whether the given name is for a defined Color.static booleanisDefinedColorName(java.lang.String cName, int mode)Checks whether the given name is for a Color defined in the given mode.static booleanisGrayScale(java.awt.Color color)Checks whether the 'color' is closest to one of the gray scales defined in this class.
-
-
-
Field Detail
-
JAXO_COLORS_MODE
public static final int JAXO_COLORS_MODE
All Colors defined in JaxoColor can be chosen.- See Also:
- Constant Field Values
-
JAXO_COLORS_NO_GRAYSCALES_MODE
public static final int JAXO_COLORS_NO_GRAYSCALES_MODE
Colors defined in JaxoColor except grayscales can be chosen.- See Also:
- Constant Field Values
-
ALL_COLORS_MODE
public static final int ALL_COLORS_MODE
Any Color can be chosen.- See Also:
- Constant Field Values
-
GREEN_YELLOW
public static final java.awt.Color GREEN_YELLOW
The color GreenYellow.
-
YELLOW
public static final java.awt.Color YELLOW
The color Yellow.
-
GOLDEN_ROD
public static final java.awt.Color GOLDEN_ROD
The color Goldenrod.
-
DANDELION
public static final java.awt.Color DANDELION
The color Dandelion.
-
APRICOT
public static final java.awt.Color APRICOT
The color Apricot.
-
PEACH
public static final java.awt.Color PEACH
The color Peach.
-
MELON
public static final java.awt.Color MELON
The color Melon.
-
YELLOW_ORANGE
public static final java.awt.Color YELLOW_ORANGE
The color YellowOrange.
-
ORANGE
public static final java.awt.Color ORANGE
The color Orange.
-
BURNT_ORANGE
public static final java.awt.Color BURNT_ORANGE
The color BurntOrange.
-
BITTERSWEET
public static final java.awt.Color BITTERSWEET
The color Bittersweet.
-
RED_ORANGE
public static final java.awt.Color RED_ORANGE
The color RedOrange.
-
MAHOGANY
public static final java.awt.Color MAHOGANY
The color Mahagony.
-
MAROON
public static final java.awt.Color MAROON
The color Maroon.
-
BRICK_RED
public static final java.awt.Color BRICK_RED
The color BrickRed.
-
RED
public static final java.awt.Color RED
The color Red.
-
ORANGE_RED
public static final java.awt.Color ORANGE_RED
The color OrangeRed.
-
RUBINE_RED
public static final java.awt.Color RUBINE_RED
The color RubineRed.
-
WILDSTRAWBERRY
public static final java.awt.Color WILDSTRAWBERRY
The color WildStrawberry.
-
SALMON
public static final java.awt.Color SALMON
The color Salmon.
-
CARNATION_PINK
public static final java.awt.Color CARNATION_PINK
The color CarnationPink.
-
MAGENTA
public static final java.awt.Color MAGENTA
The color Magenta.
-
VIOLET_RED
public static final java.awt.Color VIOLET_RED
The color VioletRed.
-
RHODAMINE
public static final java.awt.Color RHODAMINE
The color Rhodamine.
-
MULBERRY
public static final java.awt.Color MULBERRY
The color Mulberry.
-
RED_VIOLET
public static final java.awt.Color RED_VIOLET
The color RedViolet.
-
FUCHSIA
public static final java.awt.Color FUCHSIA
The color Fuchsia.
-
LAVENDER
public static final java.awt.Color LAVENDER
The color Lavender.
-
THISTLE
public static final java.awt.Color THISTLE
The color Thistle.
-
ORCHID
public static final java.awt.Color ORCHID
The color Orchid.
-
DARK_ORCHID
public static final java.awt.Color DARK_ORCHID
The color DarkOrchid.
-
PURPLE
public static final java.awt.Color PURPLE
The color Purple.
-
PLUM
public static final java.awt.Color PLUM
The color Plum.
-
VIOLET
public static final java.awt.Color VIOLET
The color Violet.
-
ROYAL_PURPLE
public static final java.awt.Color ROYAL_PURPLE
The color RoyalPurple.
-
BLUE_VIOLET
public static final java.awt.Color BLUE_VIOLET
The color BlueViolet.
-
PERIWINKLE
public static final java.awt.Color PERIWINKLE
The color Periwinkle.
-
CADET_BLUE
public static final java.awt.Color CADET_BLUE
The color CadetBlue.
-
CORNFLOWER_BLUE
public static final java.awt.Color CORNFLOWER_BLUE
The color CornflowerBlue.
-
MIDNIGHT_BLUE
public static final java.awt.Color MIDNIGHT_BLUE
The color MidnightBlue.
-
NAVY_BLUE
public static final java.awt.Color NAVY_BLUE
The color NavyBlue.
-
ROYAL_BLUE
public static final java.awt.Color ROYAL_BLUE
The color RoyalBlue.
-
BLUE
public static final java.awt.Color BLUE
The color Blue.
-
CERULEAN
public static final java.awt.Color CERULEAN
The color Cerulean.
-
CYAN
public static final java.awt.Color CYAN
The color Cyan.
-
PROCESS_BLUE
public static final java.awt.Color PROCESS_BLUE
The color ProcessBlue.
-
SKY_BLUE
public static final java.awt.Color SKY_BLUE
The color SkyBlue.
-
TURQUOISE
public static final java.awt.Color TURQUOISE
The color Turquoise.
-
TEAL_BLUE
public static final java.awt.Color TEAL_BLUE
The color TealBlue.
-
AQUAMARINE
public static final java.awt.Color AQUAMARINE
The color Aquamarine.
-
BLUE_GREEN
public static final java.awt.Color BLUE_GREEN
The color BlueGreen.
-
EMERALD
public static final java.awt.Color EMERALD
The color Emerald.
-
JUNGLE_GREEN
public static final java.awt.Color JUNGLE_GREEN
The color JungleGreen.
-
SEA_GREEN
public static final java.awt.Color SEA_GREEN
The color SeaGreen.
-
GREEN
public static final java.awt.Color GREEN
The color Green.
-
FOREST_GREEN
public static final java.awt.Color FOREST_GREEN
The color ForestGreen.
-
PINE_GREEN
public static final java.awt.Color PINE_GREEN
The color PineGreen.
-
LIME_GREEN
public static final java.awt.Color LIME_GREEN
The color LimeGreen.
-
YELLOW_GREEN
public static final java.awt.Color YELLOW_GREEN
The color YellowGreen.
-
SPRING_GREEN
public static final java.awt.Color SPRING_GREEN
The color SpringGreen.
-
OLIVE_GREEN
public static final java.awt.Color OLIVE_GREEN
The color OliveGreen.
-
RAWSIENNA
public static final java.awt.Color RAWSIENNA
The color RawSienna.
-
SEPIA
public static final java.awt.Color SEPIA
The color Sepia.
-
BROWN
public static final java.awt.Color BROWN
The color Brown.
-
TAN
public static final java.awt.Color TAN
The color Tan.
-
GRAY
public static final java.awt.Color GRAY
The color Gray.
-
BLACK
public static final java.awt.Color BLACK
The color Black.
-
GRAYSCALE15
public static final java.awt.Color GRAYSCALE15
The color GrayScale15.
-
GRAYSCALE30
public static final java.awt.Color GRAYSCALE30
The color GrayScale30.
-
GRAYSCALE45
public static final java.awt.Color GRAYSCALE45
The color GrayScale45.
-
GRAYSCALE60
public static final java.awt.Color GRAYSCALE60
The color GrayScale60.
-
GRAYSCALE75
public static final java.awt.Color GRAYSCALE75
The color GrayScale75.
-
GRAYSCALE90
public static final java.awt.Color GRAYSCALE90
The color GrayScale90.
-
GRAYSCALE105
public static final java.awt.Color GRAYSCALE105
The color GrayScale105.
-
GRAYSCALE120
public static final java.awt.Color GRAYSCALE120
The color GrayScale120.
-
GRAYSCALE135
public static final java.awt.Color GRAYSCALE135
The color GrayScale135.
-
GRAYSCALE150
public static final java.awt.Color GRAYSCALE150
The color GrayScale150.
-
GRAYSCALE165
public static final java.awt.Color GRAYSCALE165
The color GrayScale165.
-
GRAYSCALE180
public static final java.awt.Color GRAYSCALE180
The color GrayScale180.
-
GRAYSCALE195
public static final java.awt.Color GRAYSCALE195
The color GrayScale195.
-
GRAYSCALE210
public static final java.awt.Color GRAYSCALE210
The color GrayScale210.
-
GRAYSCALE225
public static final java.awt.Color GRAYSCALE225
The color GrayScale225.
-
GRAYSCALE240
public static final java.awt.Color GRAYSCALE240
The color GrayScale240.
-
WHITE
public static final java.awt.Color WHITE
The color White.
-
-
Method Detail
-
isDefinedColor
public static boolean isDefinedColor(java.awt.Color color)
Checks whether the given color is a defined Color.- Parameters:
color- A color.- Returns:
- True if color is one of the colors defined by this class.
-
isDefinedColor
public static boolean isDefinedColor(java.awt.Color color, int mode)Checks whether the given color is a defined Color in the given mode.- Parameters:
color- A color.mode- the color mode.- Returns:
- True if color is defined.
-
isDefinedColorName
public static boolean isDefinedColorName(java.lang.String cName)
Checks whether the given name is for a defined Color.- Parameters:
cName- a color name- Returns:
- True if 'cName' is a name of one of the colors defined by this class.
-
isDefinedColorName
public static boolean isDefinedColorName(java.lang.String cName, int mode)Checks whether the given name is for a Color defined in the given mode.- Parameters:
cName- a color name.mode- the color mode.- Returns:
- True if 'cName' is defined.
-
getColorCount
public static int getColorCount()
Returns the number of colors defined by JaxoColor.- Returns:
- The number of colors defined by JaxoColor.
-
getColor
public static java.awt.Color getColor(int i)
Returns the color at index i of the colorList.- Parameters:
i- Index of the color to be returned- Returns:
- Color at index i.
-
getColorName
public static java.lang.String getColorName(int i)
Returns the name of the color at index i in the colorList.- Parameters:
i- Index of the color whose name is to be returned.- Returns:
- Name of the color at index i.
-
getDefaultColor
public static java.awt.Color getDefaultColor()
Returns the current default color.- Returns:
- Returns
BLACK.
-
getDefaultFillColor
public static java.awt.Color getDefaultFillColor(java.awt.Color lineColor)
Returns the current default fill color for the given line color.- Parameters:
lineColor- The line color.- Returns:
- Returns GRAYSCALE225 if the argument is BLACK, GRAY otherwise.
-
getColor
public static java.awt.Color getColor(java.lang.String cName)
Returns the color corresponding to the name cName, or the default color if none.- Parameters:
cName- The name of the color to be returned.- Returns:
- The color corresponding to the name cName.
- See Also:
getDefaultColor()
-
getColor
public static java.awt.Color getColor(java.lang.String cName, int mode)Returns the color corresponding to the name cName, or the default color if none.- Parameters:
cName- The name of the color to be returned.mode- The mode defining the color space- Returns:
- The color corresponding to the name cName.
-
getColorName
public static java.lang.String getColorName(java.awt.Color color)
Returns the name of the closest defined color to 'color'.- Parameters:
color- Color whose name is to be returned.- Returns:
- Name of the color color.
-
getColorName
public static java.lang.String getColorName(java.awt.Color color, int space)Returns the name of the closest defined color (in the mode) color.- Parameters:
color- Color whose name is to be returned.space- defining the allowed colors.- Returns:
- Name of the color color.
-
getGrayScaleFloat
public static float getGrayScaleFloat(java.awt.Color color)
Returns a string representation of a Color that gives the grayscale of color, or sets it to '0.0' (black), if color is not a grayscale.- Parameters:
color- The color whose grayscale value is to be returned.- Returns:
- The float grayness of the grayscale corresponding to color.
-
isGrayScale
public static boolean isGrayScale(java.awt.Color color)
Checks whether the 'color' is closest to one of the gray scales defined in this class.- Parameters:
color- A color.- Returns:
- True if color is a grayscale, false otherwise.
-
getGrayScaleColor
public static java.awt.Color getGrayScaleColor(float f)
Returns the grayscale that corresponds to the float value f. or null if f is not between 0.f and 1.f- Parameters:
f- A float between 0.f and 1.f- Returns:
- The gray scale corresponding to the float value f.
-
getLatexColorCommand
public static java.lang.String getLatexColorCommand(java.awt.Color color)
Returns a String containing the LaTex color command (as used by the package colordvi) to set the color.- Parameters:
color- The color to be set in the LaTex command.- Returns:
- The String representation of the LaTex command.
-
getClosestColorTo
public static java.awt.Color getClosestColorTo(java.awt.Color refcolor, int mode)Return the Color closest (in the specified mode) to the given color.- Parameters:
refcolor- the color to be matched.mode- mode to use- Returns:
- A Color in the color space of the given mode, or null if the given color was null.
-
-