Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jvnet.substance.utils
Class SubstanceColorUtilities

    java.lang.Object
      org.jvnet.substance.utils.SubstanceColorUtilities

    public class SubstanceColorUtilities

extends java.lang.Object

Various color-related utilities. This class is for internal use only.

Author:
  Kirill Grouchnikov

Constructor Summary
`SubstanceColorUtilities()`

Method Summary
`static java.awt.Color` | `deriveByBrightness(java.awt.Color original, java.awt.Color brightnessSource)` Derives a color based on the original color and a brightness source.
`static java.awt.Color` | `getAlphaColor(java.awt.Color color, int alpha)` Returns a translucent of the specified color.
`static java.awt.Color` | `getBackgroundFillColor(java.awt.Component component)` Returns the background fill color of the specified component.
`static java.awt.Color` | `getBottomBorderColor(SubstanceColorScheme scheme1, SubstanceColorScheme scheme2, double cycleCoef)` Returns the color of the bottom portion of border in control backgrounds.
`static java.awt.Color` | `getBottomFillColor(SubstanceColorScheme scheme1, SubstanceColorScheme scheme2, double cycleCoef, boolean useCyclePosAsInterpolation)` Returns the color of the bottom portion of fill in control backgrounds.
`static java.awt.Color` | `getBottomShineColor(SubstanceColorScheme scheme1, SubstanceColorScheme scheme2, double cycleCoef, boolean useCyclePosAsInterpolation)` Returns the color of the bottom portion of shine in control backgrounds.
`static int` | `getColorBrightness(int rgb)` Returns the brightness of the specified color.
`static float` | `getColorStrength(java.awt.Color color)` Returns the color strength.
`static java.awt.Color` | `getDarkerColor(java.awt.Color color, double diff)` Returns darker version of the specified color.
`static javax.swing.plaf.ColorUIResource` | `getDefaultBackgroundColor(java.lang.Class<?> componentClass, SubstanceSkin skin, boolean isDisabled)` Returns the default background color for the components of the specified class.
`static javax.swing.plaf.ColorUIResource` | `getDefaultBackgroundColor(java.awt.Component comp, ComponentState compState)` Returns the default background color for the specified component.
`static java.awt.Color` | `getFocusColor(java.awt.Component comp)` Returns the color of the focus ring for the specified component.
`static java.awt.Color` | `getForegroundColor(java.awt.Component component, ComponentState state, ComponentState prevState)` Returns the foreground text color of the specified component.
`static java.awt.Color` | `getForegroundColor(javax.swing.JTabbedPane tabPane, int tabIndex, ComponentState state, ComponentState prevState)` Returns the foreground text color of the specified tabbed pane tab.
`static javax.swing.plaf.ColorUIResource` | `getForegroundColor(SubstanceColorScheme scheme)` Returns the foreground color of the specified color scheme.
`static java.awt.Color` | `getHueShiftedColor(java.awt.Color color, double hueShift)` Returns hue-shifted (in HSV space) version of the specified color.
`static java.awt.Color` | `getInterpolatedColor(java.awt.Color color1, java.awt.Color color2, double color1Likeness)` Interpolates color.
`static java.awt.Color` | `getInterpolatedForegroundColor(java.awt.Component comp, java.lang.Comparable<?> componentId, SubstanceColorScheme colorScheme, ComponentState state, ComponentState prevState, org.jvnet.lafwidget.animation.FadeKind... kinds)` Returns the foreground color for the specified component.
`static int` | `getInterpolatedRGB(java.awt.Color color1, java.awt.Color color2, double color1Likeness)` Interpolates color.
`static java.awt.Color` | `getLighterColor(java.awt.Color color, double diff)` Returns lighter version of the specified color.
`static java.awt.Color` | `getMarkColor(SubstanceColorScheme colorScheme, boolean isEnabled)` Returns the color of mark icons (checkbox, radio button, scrollbar arrows, combo arrows, menu arrows etc) for the specified color scheme.
`static java.awt.Color` | `getMidBorderColor(SubstanceColorScheme scheme1, SubstanceColorScheme scheme2, double cycleCoef)` Returns the color of the middle portion of border in control backgrounds.
`static java.awt.Color` | `getMidFillColor(SubstanceColorScheme scheme1, SubstanceColorScheme scheme2, double cycleCoef, boolean useCyclePosAsInterpolation)` Returns the color of the middle portion of fill in control backgrounds.
`static java.awt.Color` | `getNegativeColor(java.awt.Color color)` Returns a negative of the specified color.
`static int` | `getNegativeColor(int rgb)` Returns a negative of the specified color.
`static java.awt.Color` | `getSaturatedColor(java.awt.Color color, double factor)` Returns saturated version of the specified color.
`static java.awt.Color` | `getStripedBackground(javax.swing.JComponent component, int rowIndex)` Returns the striped background for the specified component.
`static java.awt.Color` | `getTopBorderColor(SubstanceColorScheme scheme1, SubstanceColorScheme scheme2, double cycleCoef)` Returns the color of the top portion of border in control backgrounds.
`static java.awt.Color` | `getTopFillColor(SubstanceColorScheme scheme1, SubstanceColorScheme scheme2, double cycleCoef, boolean useCyclePosAsInterpolation)` Returns the color of the top portion of fill in control backgrounds.
`static java.awt.Color` | `getTopShineColor(SubstanceColorScheme scheme1, SubstanceColorScheme scheme2, double cycleCoef, boolean useCyclePosAsInterpolation)` Returns the color of the top portion of shine in control backgrounds.
`static java.awt.Color` | `invertColor(java.awt.Color color)` Inverts the specified color.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SubstanceColorUtilities

    public SubstanceColorUtilities()

Method Detail

### getTopBorderColor

    public static java.awt.Color getTopBorderColor(SubstanceColorScheme scheme1,
                                                   SubstanceColorScheme scheme2,
                                                   double cycleCoef)

  Returns the color of the top portion of border in control backgrounds.

  Parameters:
    `scheme1` - The first color scheme.
    `scheme2` - The second color scheme.
    `cycleCoef` - Cycle position. Is used for rollover and pulsation effects. Must be in 0.0 .. 1.0 range.
  Returns:
    The color of the top portion of border in control backgrounds.

### getMidBorderColor

    public static java.awt.Color getMidBorderColor(SubstanceColorScheme scheme1,
                                                   SubstanceColorScheme scheme2,
                                                   double cycleCoef)

  Returns the color of the middle portion of border in control backgrounds.

  Parameters:
    `scheme1` - The first color scheme.
    `scheme2` - The second color scheme.
    `cycleCoef` - Cycle position. Is used for rollover and pulsation effects. Must be in 0.0 .. 1.0 range.
  Returns:
    The color of the middle portion of border in control backgrounds.

### getBottomBorderColor

    public static java.awt.Color getBottomBorderColor(SubstanceColorScheme scheme1,
                                                      SubstanceColorScheme scheme2,
                                                      double cycleCoef)

  Returns the color of the bottom portion of border in control backgrounds.

  Parameters:
    `scheme1` - The first color scheme.
    `scheme2` - The second color scheme.
    `cycleCoef` - Cycle position. Is used for rollover and pulsation effects. Must be in 0.0 .. 1.0 range.
  Returns:
    The color of the bottom portion of border in control backgrounds.

### getTopFillColor

    public static java.awt.Color getTopFillColor(SubstanceColorScheme scheme1,
                                                 SubstanceColorScheme scheme2,
                                                 double cycleCoef,
                                                 boolean useCyclePosAsInterpolation)

  Returns the color of the top portion of fill in control backgrounds.

  Parameters:
    `scheme1` - The first color scheme.
    `scheme2` - The second color scheme.
    `cycleCoef` - Cycle position. Is used for rollover and pulsation effects. Must be in 0.0 .. 1.0 range.
    `useCyclePosAsInterpolation` - Indicates the algorithm to use for computing various colors. If `true`, the `cyclePos` is used to interpolate colors between different color components of both color schemes. If `false`, the `cyclePos` is used to interpolate colors between different color components of the first color scheme.
  Returns:
    The color of the top portion of fill in control backgrounds.

### getMidFillColor

    public static java.awt.Color getMidFillColor(SubstanceColorScheme scheme1,
                                                 SubstanceColorScheme scheme2,
                                                 double cycleCoef,
                                                 boolean useCyclePosAsInterpolation)

  Returns the color of the middle portion of fill in control backgrounds.

  Parameters:
    `scheme1` - The first color scheme.
    `scheme2` - The second color scheme.
    `cycleCoef` - Cycle position. Is used for rollover and pulsation effects. Must be in 0.0 .. 1.0 range.
    `useCyclePosAsInterpolation` - Indicates the algorithm to use for computing various colors. If `true`, the `cyclePos` is used to interpolate colors between different color components of both color schemes. If `false`, the `cyclePos` is used to interpolate colors between different color components of the first color scheme.
  Returns:
    The color of the middle portion of fill in control backgrounds.

### getBottomFillColor

    public static java.awt.Color getBottomFillColor(SubstanceColorScheme scheme1,
                                                    SubstanceColorScheme scheme2,
                                                    double cycleCoef,
                                                    boolean useCyclePosAsInterpolation)

  Returns the color of the bottom portion of fill in control backgrounds.

  Parameters:
    `scheme1` - The first color scheme.
    `scheme2` - The second color scheme.
    `cycleCoef` - Cycle position. Is used for rollover and pulsation effects. Must be in 0.0 .. 1.0 range.
    `useCyclePosAsInterpolation` - Indicates the algorithm to use for computing various colors. If `true`, the `cyclePos` is used to interpolate colors between different color components of both color schemes. If `false`, the `cyclePos` is used to interpolate colors between different color components of the first color scheme.
  Returns:
    The color of the bottom portion of fill in control backgrounds.

### getTopShineColor

    public static java.awt.Color getTopShineColor(SubstanceColorScheme scheme1,
                                                  SubstanceColorScheme scheme2,
                                                  double cycleCoef,
                                                  boolean useCyclePosAsInterpolation)

  Returns the color of the top portion of shine in control backgrounds.

  Parameters:
    `scheme1` - The first color scheme.
    `scheme2` - The second color scheme.
    `cycleCoef` - Cycle position. Is used for rollover and pulsation effects. Must be in 0.0 .. 1.0 range.
    `useCyclePosAsInterpolation` - Indicates the algorithm to use for computing various colors. If `true`, the `cyclePos` is used to interpolate colors between different color components of both color schemes. If `false`, the `cyclePos` is used to interpolate colors between different color components of the first color scheme.
  Returns:
    The color of the top portion of shine in control backgrounds.

### getBottomShineColor

    public static java.awt.Color getBottomShineColor(SubstanceColorScheme scheme1,
                                                     SubstanceColorScheme scheme2,
                                                     double cycleCoef,
                                                     boolean useCyclePosAsInterpolation)

  Returns the color of the bottom portion of shine in control backgrounds.

  Parameters:
    `scheme1` - The first color scheme.
    `scheme2` - The second color scheme.
    `cycleCoef` - Cycle position. Is used for rollover and pulsation effects. Must be in 0.0 .. 1.0 range.
    `useCyclePosAsInterpolation` - Indicates the algorithm to use for computing various colors. If `true`, the `cyclePos` is used to interpolate colors between different color components of both color schemes. If `false`, the `cyclePos` is used to interpolate colors between different color components of the first color scheme.
  Returns:
    The color of the bottom portion of shine in control backgrounds.

### getInterpolatedRGB

    public static int getInterpolatedRGB(java.awt.Color color1,
                                         java.awt.Color color2,
                                         double color1Likeness)

  Interpolates color.

  Parameters:
    `color1` - The first color
    `color2` - The second color
    `color1Likeness` - The closer this value is to 0.0, the closer the resulting color will be to `color2`.
  Returns:
    Interpolated RGB value.

### getInterpolatedColor

    public static java.awt.Color getInterpolatedColor(java.awt.Color color1,
                                                      java.awt.Color color2,
                                                      double color1Likeness)

  Interpolates color.

  Parameters:
    `color1` - The first color
    `color2` - The second color
    `color1Likeness` - The closer this value is to 0.0, the closer the resulting color will be to `color2`.
  Returns:
    Interpolated color.

### invertColor

    public static java.awt.Color invertColor(java.awt.Color color)

  Inverts the specified color.

  Parameters:
    `color` - The original color.
  Returns:
    The inverted color.

### getNegativeColor

    public static java.awt.Color getNegativeColor(java.awt.Color color)

  Returns a negative of the specified color.

  Parameters:
    `color` - Color.
  Returns:
    Negative of the specified color.

### getNegativeColor

    public static int getNegativeColor(int rgb)

  Returns a negative of the specified color.

  Parameters:
    `rgb` - Color RGB.
  Returns:
    Negative of the specified color.

### getAlphaColor

    public static java.awt.Color getAlphaColor(java.awt.Color color,
                                               int alpha)

  Returns a translucent of the specified color.

  Parameters:
    `color` - Color.
    `alpha` - Alpha channel value.
  Returns:
    Translucent of the specified color that matches the requested alpha channel value.

### getSaturatedColor

    public static java.awt.Color getSaturatedColor(java.awt.Color color,
                                                   double factor)

  Returns saturated version of the specified color.

  Parameters:
    `color` - Color.
    `factor` - Saturation factor.
  Returns:
    Saturated color.

### getHueShiftedColor

    public static java.awt.Color getHueShiftedColor(java.awt.Color color,
                                                    double hueShift)

  Returns hue-shifted (in HSV space) version of the specified color.

  Parameters:
    `color` - Color.
    `hueShift` - hue shift factor.
  Returns:
    Hue-shifted (in HSV space) color.

### deriveByBrightness

    public static java.awt.Color deriveByBrightness(java.awt.Color original,
                                                    java.awt.Color brightnessSource)

  Derives a color based on the original color and a brightness source. The resulting color has the same hue and saturation as the original color, but its brightness is shifted towards the brightness of the brightness source. Thus, a light red color shifted towards dark green will become dark red.

  Parameters:
    `original` - Original color.
    `brightnessSource` - Brightness source.
  Returns:
    Derived color that has the same hue and saturation as the original color, but its brightness is shifted towards the brightness of the brightness source.

### getForegroundColor

    public static javax.swing.plaf.ColorUIResource getForegroundColor(SubstanceColorScheme scheme)

  Returns the foreground color of the specified color scheme.

  Parameters:
    `scheme` - Color scheme.
  Returns:
    Color scheme foreground color.

### getLighterColor

    public static java.awt.Color getLighterColor(java.awt.Color color,
                                                 double diff)

  Returns lighter version of the specified color.

  Parameters:
    `color` - Color.
    `diff` - Difference factor (values closer to 0.0 will produce results closer to white color).
  Returns:
    Lighter version of the specified color.

### getDarkerColor

    public static java.awt.Color getDarkerColor(java.awt.Color color,
                                                double diff)

  Returns darker version of the specified color.

  Parameters:
    `color` - Color.
    `diff` - Difference factor (values closer to 1.0 will produce results closer to black color).
  Returns:
    Darker version of the specified color.

### getColorBrightness

    public static int getColorBrightness(int rgb)

  Returns the brightness of the specified color.

  Parameters:
    `rgb` - RGB value of a color.
  Returns:
    The brightness of the specified color.

### getFocusColor

    public static java.awt.Color getFocusColor(java.awt.Component comp)

  Returns the color of the focus ring for the specified component.

  Parameters:
    `comp` - Component.
  Returns:
    The color of the focus ring for the specified component.

### getColorStrength

    public static float getColorStrength(java.awt.Color color)

  Returns the color strength.

  Parameters:
    `color` - Color.
  Returns:
    Color strength.

### getMarkColor

    public static java.awt.Color getMarkColor(SubstanceColorScheme colorScheme,
                                              boolean isEnabled)

  Returns the color of mark icons (checkbox, radio button, scrollbar arrows, combo arrows, menu arrows etc) for the specified color scheme.

  Parameters:
    `colorScheme` - Color scheme.
    `isEnabled` - If `true`, the mark should be painted in enabled state.
  Returns:
    Color of mark icons.

### getForegroundColor

    public static java.awt.Color getForegroundColor(java.awt.Component component,
                                                    ComponentState state,
                                                    ComponentState prevState)

  Returns the foreground text color of the specified component.

  Parameters:
    `component` - Component.
    `state` - Component current state.
    `prevState` - Component previous state.
  Returns:
    The foreground text color of the specified component.

### getForegroundColor

    public static java.awt.Color getForegroundColor(javax.swing.JTabbedPane tabPane,
                                                    int tabIndex,
                                                    ComponentState state,
                                                    ComponentState prevState)

  Returns the foreground text color of the specified tabbed pane tab.

  Parameters:
    `tabPane` - Tabbed pane.
    `tabIndex` - Tab index.
    `state` - Component current state.
    `prevState` - Component previous state.
  Returns:
    The foreground text color of the specified tabbed pane tab.

### getInterpolatedForegroundColor

    public static java.awt.Color getInterpolatedForegroundColor(java.awt.Component comp,
                                                                java.lang.Comparable<?> componentId,
                                                                SubstanceColorScheme colorScheme,
                                                                ComponentState state,
                                                                ComponentState prevState,
                                                                org.jvnet.lafwidget.animation.FadeKind... kinds)

  Returns the foreground color for the specified component.

  Parameters:
    `comp` - Component.
    `componentId` - Optional component ID. Can be used to differentiate sub-parts of the component, such as tabs in tabbed pane, cells in list etc.
    `colorScheme` - Component color scheme.
    `state` - Component current state.
    `prevState` - Component previous state.
    `kinds` - Animation kinds to consult for computing the foreground color.
  Returns:
    Foreground color.

### getBackgroundFillColor

    public static java.awt.Color getBackgroundFillColor(java.awt.Component component)

  Returns the background fill color of the specified component.

  Parameters:
    `component` - Component.
  Returns:
    The background fill color of the specified component.

### getDefaultBackgroundColor

    public static javax.swing.plaf.ColorUIResource getDefaultBackgroundColor(java.lang.Class<?> componentClass,
                                                                             SubstanceSkin skin,
                                                                             boolean isDisabled)

  Returns the default background color for the components of the specified class.

  Parameters:
    `componentClass` - Component class.
    `skin` - Skin.
    `isDisabled` - Indication whether the result should be for disabled components.
  Returns:
    The default background color for the components of the specified class.

### getDefaultBackgroundColor

    public static javax.swing.plaf.ColorUIResource getDefaultBackgroundColor(java.awt.Component comp,
                                                                             ComponentState compState)

  Returns the default background color for the specified component.

  Parameters:
    `comp` - Component.
    `compState` - Component state.
  Returns:
    The default background color for the components of the specified class.

### getStripedBackground

    public static java.awt.Color getStripedBackground(javax.swing.JComponent component,
                                                      int rowIndex)

  Returns the striped background for the specified component. This method is relevant for components such as trees, tables and lists that use odd-even striping for the alternating rows.

  Parameters:
    `component` - Component.
    `rowIndex` - Row index.
  Returns:
    The striped background for the specified component.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD