public class SubstanceColorUtilities extends Object
Constructor | Description |
---|---|
SubstanceColorUtilities() |
Modifier and Type | Method | Description |
---|---|---|
static 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 |
encode(Color color) |
|
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 |
getBottomBorderColor(SubstanceColorScheme scheme) |
Returns the color of the bottom portion of border in control backgrounds.
|
static Color |
getBottomFillColor(SubstanceColorScheme scheme) |
Returns the color of the bottom portion of fill in control backgrounds.
|
static Color |
getBottomShineColor(SubstanceColorScheme scheme) |
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 |
getForegroundColor(SubstanceColorScheme scheme) |
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 |
getMidBorderColor(SubstanceColorScheme scheme) |
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 |
getTopBorderColor(SubstanceColorScheme scheme) |
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.
|
public static Color getTopBorderColor(SubstanceColorScheme scheme)
scheme
- The color scheme.public static Color getMidBorderColor(SubstanceColorScheme scheme)
scheme
- The color scheme.public static Color getBottomBorderColor(SubstanceColorScheme scheme)
scheme
- The color scheme.public static Color getTopFillColor(SubstanceColorScheme scheme)
public static Color getMidFillColor(SubstanceColorScheme scheme)
public static Color getBottomFillColor(SubstanceColorScheme scheme)
public static Color getTopShineColor(SubstanceColorScheme scheme)
public static Color getBottomShineColor(SubstanceColorScheme scheme)
public static int getInterpolatedRGB(Color color1, Color color2, double color1Likeness)
color1
- The first colorcolor2
- The second colorcolor1Likeness
- The closer this value is to 0.0, the closer the resulting
color will be to color2
.public static Color getInterpolatedColor(Color color1, Color color2, double color1Likeness)
color1
- The first colorcolor2
- The second colorcolor1Likeness
- The closer this value is to 0.0, the closer the resulting
color will be to color2
.public static Color invertColor(Color color)
color
- The original color.public static Color getNegativeColor(Color color)
color
- Color.public static int getNegativeColor(int rgb)
rgb
- Color RGB.public static Color getAlphaColor(Color color, int alpha)
color
- Color.alpha
- Alpha channel value.public static Color getSaturatedColor(Color color, double factor)
color
- Color.factor
- Saturation factor.public static Color getHueShiftedColor(Color color, double hueShift)
color
- Color.hueShift
- hue shift factor.public static Color deriveByBrightness(Color original, Color brightnessSource)
original
- Original color.brightnessSource
- Brightness source.public static ColorUIResource getForegroundColor(SubstanceColorScheme scheme)
scheme
- Color scheme.public static Color getLighterColor(Color color, double diff)
color
- Color.diff
- Difference factor (values closer to 1.0 will produce results
closer to white color).public static Color getDarkerColor(Color color, double diff)
color
- Color.diff
- Difference factor (values closer to 1.0 will produce results
closer to black color).public static int getColorBrightness(int rgb)
rgb
- RGB value of a color.public static Color getFocusColor(Component comp, TransitionAwareUI transitionAwareUI)
comp
- Component.public static float getColorStrength(Color color)
color
- Color.public static Color getMarkColor(SubstanceColorScheme colorScheme, boolean isEnabled)
colorScheme
- Color scheme.isEnabled
- If true
, the mark should be painted in enabled
state.public static Color getForegroundColor(Component component, StateTransitionTracker.ModelStateInfo modelStateInfo)
component
- Component.modelStateInfo
- The mode state infopublic static Color getMenuComponentForegroundColor(Component menuComponent, StateTransitionTracker.ModelStateInfo modelStateInfo)
menuComponent
- Menu component.modelStateInfo
- Model state info for the component.public static Color getBackgroundFillColor(Component component)
component
- Component.public static Color getOuterTextComponentBorderColor(Color fillBackgroundColor)
public static ColorUIResource getDefaultBackgroundColor(boolean toTreatAsTextComponent, SubstanceSkin skin, boolean isDisabled)
toTreatAsTextComponent
- if the component is to be colored as a text component.skin
- Skin.isDisabled
- Indication whether the result should be for disabled
components.public static ColorUIResource getDefaultBackgroundColor(Component comp, ComponentState compState)
comp
- Component.compState
- Component state.public static Color getStripedBackground(JComponent component, int rowIndex)
component
- Component.rowIndex
- Row index.public static String encode(int number)