Class RadianceColorUtilities
- java.lang.Object
-
- org.pushingpixels.radiance.theming.internal.utils.RadianceColorUtilities
-
public class RadianceColorUtilities extends java.lang.ObjectVarious color-related utilities. This class is for internal use only.
-
-
Field Summary
Fields Modifier and Type Field Description private static BladeContainerColorTokensmutableContainerTokens
-
Constructor Summary
Constructors Constructor Description RadianceColorUtilities()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.awt.ColorderiveByBrightness(java.awt.Color original, float brightnessFactor)static java.lang.Stringencode(int number)static java.lang.Stringencode(java.awt.Color color)private static doubleEOCF_sRGB(double srgb)static java.awt.ColorgetAlphaColor(java.awt.Color color, int alpha)Returns a translucent of the specified color.static java.awt.ColorgetBackgroundFillColor(java.awt.Component component, CoreColorTokenUtils.ContainerType inactiveContainerType)Returns the background fill color of the specified component.static java.awt.ColorgetBackgroundFillColorScrollBar(javax.swing.JScrollBar scrollbar)static intgetColorBrightness(int rgb)Returns the brightness of the specified color.static java.awt.ColorgetDarkerColor(java.awt.Color color, double diff)Returns darker version of the specified color.private static javax.swing.plaf.ColorUIResourcegetDefaultBackgroundColor(java.awt.Component comp, ComponentState compState)static java.awt.ColorgetFocusColor(java.awt.Component comp, TransitionAwareUI transitionAwareUI)Returns the color of the focus ring for the specified component.static floatgetForegroundAlpha(java.awt.Component component, StateTransitionTracker.ModelStateInfo modelStateInfo, CoreColorTokenUtils.ContainerType inactiveContainerType)static java.awt.ColorgetForegroundColor(java.awt.Component component, StateTransitionTracker.ModelStateInfo modelStateInfo, CoreColorTokenUtils.ContainerType inactiveContainerType)Returns the foreground text color of the specified component.static javax.swing.plaf.ColorUIResourcegetForegroundColor(ContainerColorTokens colorTokens)Returns the foreground color of the specified color tokens.static java.awt.ColorgetForegroundVariantColor(java.awt.Component component, StateTransitionTracker.ModelStateInfo modelStateInfo, CoreColorTokenUtils.ContainerType inactiveContainerType)private static intgetInterpolatedChannelValue(int value1, int value2, double value1Likeness)static java.awt.ColorgetInterpolatedColor(java.awt.Color color1, java.awt.Color color2, double color1Likeness)Interpolates color.static intgetInterpolatedRGB(java.awt.Color color1, java.awt.Color color2, double color1Likeness)Interpolates color.static java.awt.ColorgetLighterColor(java.awt.Color color, double diff)Returns lighter version of the specified color.static floatgetMenuComponentForegroundAlpha(javax.swing.JMenuItem menuComponent, StateTransitionTracker.ModelStateInfo modelStateInfo, CoreColorTokenUtils.ContainerType inactiveContainerType)static java.awt.ColorgetMenuComponentForegroundColor(javax.swing.JMenuItem menuComponent, StateTransitionTracker.ModelStateInfo modelStateInfo, CoreColorTokenUtils.ContainerType inactiveContainerType)Returns the foreground text color of the specified menu component.static java.awt.ColorgetSaturatedColor(java.awt.Color color, double factor)Returns saturated version of the specified color.static java.awt.ColorgetStripedBackground(javax.swing.JComponent component, int rowIndex)Returns the striped background for the specified component.private static doubleOECF_sRGB(double linear)static java.awt.ColoroverlayColor(java.awt.Color base, java.awt.Color overlay)
-
-
-
Field Detail
-
mutableContainerTokens
private static BladeContainerColorTokens mutableContainerTokens
-
-
Method Detail
-
getInterpolatedRGB
public static int getInterpolatedRGB(java.awt.Color color1, java.awt.Color color2, double color1Likeness)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.
-
getInterpolatedChannelValue
private static int getInterpolatedChannelValue(int value1, int value2, double value1Likeness)
-
OECF_sRGB
private static double OECF_sRGB(double linear)
-
EOCF_sRGB
private static double EOCF_sRGB(double srgb)
-
getInterpolatedColor
public static java.awt.Color getInterpolatedColor(java.awt.Color color1, java.awt.Color color2, double color1Likeness)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.
-
overlayColor
public static java.awt.Color overlayColor(java.awt.Color base, java.awt.Color overlay)
-
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.
-
deriveByBrightness
public static java.awt.Color deriveByBrightness(java.awt.Color original, float brightnessFactor)
-
getForegroundColor
public static javax.swing.plaf.ColorUIResource getForegroundColor(ContainerColorTokens colorTokens)
Returns the foreground color of the specified color tokens.- Parameters:
colorTokens- Color tokens.- Returns:
- Color tokens 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 1.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, TransitionAwareUI transitionAwareUI)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.
-
getForegroundColor
public static java.awt.Color getForegroundColor(java.awt.Component component, StateTransitionTracker.ModelStateInfo modelStateInfo, CoreColorTokenUtils.ContainerType inactiveContainerType)Returns the foreground text color of the specified component.- Parameters:
component- Component.modelStateInfo- Component model state info.- Returns:
- The foreground text color of the specified component.
-
getForegroundVariantColor
public static java.awt.Color getForegroundVariantColor(java.awt.Component component, StateTransitionTracker.ModelStateInfo modelStateInfo, CoreColorTokenUtils.ContainerType inactiveContainerType)
-
getForegroundAlpha
public static float getForegroundAlpha(java.awt.Component component, StateTransitionTracker.ModelStateInfo modelStateInfo, CoreColorTokenUtils.ContainerType inactiveContainerType)
-
getMenuComponentForegroundColor
public static java.awt.Color getMenuComponentForegroundColor(javax.swing.JMenuItem menuComponent, StateTransitionTracker.ModelStateInfo modelStateInfo, CoreColorTokenUtils.ContainerType inactiveContainerType)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.
-
getMenuComponentForegroundAlpha
public static float getMenuComponentForegroundAlpha(javax.swing.JMenuItem menuComponent, StateTransitionTracker.ModelStateInfo modelStateInfo, CoreColorTokenUtils.ContainerType inactiveContainerType)
-
getBackgroundFillColor
public static java.awt.Color getBackgroundFillColor(java.awt.Component component, CoreColorTokenUtils.ContainerType inactiveContainerType)Returns the background fill color of the specified component.- Parameters:
component- Component.- Returns:
- The background fill color of the specified component.
-
getBackgroundFillColorScrollBar
public static java.awt.Color getBackgroundFillColorScrollBar(javax.swing.JScrollBar scrollbar)
-
getDefaultBackgroundColor
private static javax.swing.plaf.ColorUIResource getDefaultBackgroundColor(java.awt.Component comp, ComponentState compState)
-
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.
-
encode
public static java.lang.String encode(int number)
-
encode
public static java.lang.String encode(java.awt.Color color)
-
-