Class SubstanceColorUtilities
java.lang.Object
org.pushingpixels.substance.internal.utils.SubstanceColorUtilities
Various color-related utilities. This class is for internal use only.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Color
deriveByBrightness
(Color original, Color brightnessSource) Derives a color based on the original color and a brightness source.static String
encode
(int number) static String
static Color
getAlphaColor
(Color color, int alpha) Returns a translucent of the specified color.static Color
getBackgroundFillColor
(Component component) Returns the background fill color of the specified component.static Color
Returns the color of the bottom portion of border in control backgrounds.static Color
Returns the color of the bottom portion of fill in control backgrounds.static Color
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
(Color color) Returns the color strength.static Color
getDarkerColor
(Color color, double diff) Returns darker version of the specified color.static ColorUIResource
getDefaultBackgroundColor
(boolean toTreatAsTextComponent, SubstanceSkin skin, boolean isDisabled) Returns the default background color for the components of the specified class.static ColorUIResource
getDefaultBackgroundColor
(Component comp, ComponentState compState) Returns the default background color for the specified component.static Color
getFocusColor
(Component comp, TransitionAwareUI transitionAwareUI) Returns the color of the focus ring for the specified component.static Color
getForegroundColor
(Component component, StateTransitionTracker.ModelStateInfo modelStateInfo) Returns the foreground text color of the specified component.static ColorUIResource
Returns the foreground color of the specified color scheme.static Color
getHueShiftedColor
(Color color, double hueShift) Returns hue-shifted (in HSV space) version of the specified color.static Color
getInterpolatedColor
(Color color1, Color color2, double color1Likeness) Interpolates color.static int
getInterpolatedRGB
(Color color1, Color color2, double color1Likeness) Interpolates color.static Color
getLighterColor
(Color color, double diff) Returns lighter version of the specified color.static 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 Color
getMenuComponentForegroundColor
(Component menuComponent, StateTransitionTracker.ModelStateInfo modelStateInfo) Returns the foreground text color of the specified menu component.static Color
Returns the color of the middle portion of border in control backgrounds.static Color
getMidFillColor
(SubstanceColorScheme scheme) Returns the color of the middle portion of fill in control backgrounds.static int
getNegativeColor
(int rgb) Returns a negative of the specified color.static Color
getNegativeColor
(Color color) Returns a negative of the specified color.static Color
getOuterTextComponentBorderColor
(Color fillBackgroundColor) static Color
getSaturatedColor
(Color color, double factor) Returns saturated version of the specified color.static Color
getStripedBackground
(JComponent component, int rowIndex) Returns the striped background for the specified component.static Color
Returns the color of the top portion of border in control backgrounds.static Color
getTopFillColor
(SubstanceColorScheme scheme) Returns the color of the top portion of fill in control backgrounds.static Color
getTopShineColor
(SubstanceColorScheme scheme) Returns the color of the top portion of shine in control backgrounds.static Color
invertColor
(Color color) Inverts the specified color.
-
Constructor Details
-
SubstanceColorUtilities
public SubstanceColorUtilities()
-
-
Method Details
-
getTopBorderColor
Returns the color of the top portion of border in control backgrounds.- Parameters:
scheme
- The color scheme.- Returns:
- The color of the top portion of border in control backgrounds.
-
getMidBorderColor
Returns the color of the middle portion of border in control backgrounds.- Parameters:
scheme
- The color scheme.- Returns:
- The color of the middle portion of border in control backgrounds.
-
getBottomBorderColor
Returns the color of the bottom portion of border in control backgrounds.- Parameters:
scheme
- The color scheme.- Returns:
- The color of the bottom portion of border in control backgrounds.
-
getTopFillColor
Returns the color of the top portion of fill in control backgrounds.- Returns:
- The color of the top portion of fill in control backgrounds.
-
getMidFillColor
Returns the color of the middle portion of fill in control backgrounds.- Returns:
- The color of the middle portion of fill in control backgrounds.
-
getBottomFillColor
Returns the color of the bottom portion of fill in control backgrounds.- Returns:
- The color of the bottom portion of fill in control backgrounds.
-
getTopShineColor
Returns the color of the top portion of shine in control backgrounds.- Returns:
- The color of the top portion of shine in control backgrounds.
-
getBottomShineColor
Returns the color of the bottom portion of shine in control backgrounds.- Returns:
- The color of the bottom portion of shine in control backgrounds.
-
getInterpolatedRGB
Interpolates color.- Parameters:
color1
- The first colorcolor2
- The second colorcolor1Likeness
- The closer this value is to 0.0, the closer the resulting color will be tocolor2
.- Returns:
- Interpolated RGB value.
-
getInterpolatedColor
Interpolates color.- Parameters:
color1
- The first colorcolor2
- The second colorcolor1Likeness
- The closer this value is to 0.0, the closer the resulting color will be tocolor2
.- Returns:
- Interpolated color.
-
invertColor
Inverts the specified color.- Parameters:
color
- The original color.- Returns:
- The inverted color.
-
getNegativeColor
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
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
Returns saturated version of the specified color.- Parameters:
color
- Color.factor
- Saturation factor.- Returns:
- Saturated color.
-
getHueShiftedColor
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
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
Returns the foreground color of the specified color scheme.- Parameters:
scheme
- Color scheme.- Returns:
- Color scheme foreground color.
-
getLighterColor
Returns lighter version of the specified color.- Parameters:
color
- Color.diff
- Difference factor (values closer to 1.0 will produce results closer to white color).- Returns:
- Lighter version of the specified color.
-
getDarkerColor
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
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
Returns the color strength.- Parameters:
color
- Color.- Returns:
- Color strength.
-
getMarkColor
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
- Iftrue
, the mark should be painted in enabled state.- Returns:
- Color of mark icons.
-
getForegroundColor
public static Color getForegroundColor(Component component, StateTransitionTracker.ModelStateInfo modelStateInfo) Returns the foreground text color of the specified component.- Parameters:
component
- Component.modelStateInfo
- The mode state info- Returns:
- The foreground text color of the specified component.
-
getMenuComponentForegroundColor
public static Color getMenuComponentForegroundColor(Component menuComponent, StateTransitionTracker.ModelStateInfo modelStateInfo) Returns the foreground text color of the specified menu component.- Parameters:
menuComponent
- Menu component.modelStateInfo
- Model state info for the component.- Returns:
- The foreground text color of the specified menu component.
-
getBackgroundFillColor
Returns the background fill color of the specified component.- Parameters:
component
- Component.- Returns:
- The background fill color of the specified component.
-
getOuterTextComponentBorderColor
-
getDefaultBackgroundColor
public static ColorUIResource getDefaultBackgroundColor(boolean toTreatAsTextComponent, SubstanceSkin skin, boolean isDisabled) Returns the default background color for the components of the specified class.- Parameters:
toTreatAsTextComponent
- if the component is to be colored as a text component.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
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
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.
-
encode
-
encode
-