Class RadianceColorUtilities
java.lang.Object
org.pushingpixels.radiance.theming.internal.utils.RadianceColorUtilities
Various color-related utilities. This class is for internal use only.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ColorderiveByBrightness(Color original, float brightnessFactor) static Stringencode(int number) static Stringprivate static doubleEOCF_sRGB(double srgb) static ColorgetAlphaColor(Color color, int alpha) Returns a translucent of the specified color.static ColorgetBackgroundFillColor(Component component, CoreColorTokenUtils.ContainerType inactiveContainerType) Returns the background fill color of the specified component.static ColorgetBackgroundFillColorScrollBar(JScrollBar scrollbar) static intgetColorBrightness(int rgb) Returns the brightness of the specified color.static ColorgetDarkerColor(Color color, double diff) Returns darker version of the specified color.private static ColorUIResourcegetDefaultBackgroundColor(Component comp, ComponentState compState) static ColorgetFocusColor(Component comp, TransitionAwareUI transitionAwareUI) Returns the color of the focus ring for the specified component.static floatgetForegroundAlpha(Component component, StateTransitionTracker.ModelStateInfo modelStateInfo, CoreColorTokenUtils.ContainerType inactiveContainerType) static ColorgetForegroundColor(Component component, StateTransitionTracker.ModelStateInfo modelStateInfo, CoreColorTokenUtils.ContainerType inactiveContainerType) Returns the foreground text color of the specified component.static ColorUIResourcegetForegroundColor(ContainerColorTokens colorTokens) Returns the foreground color of the specified color tokens.static ColorgetForegroundVariantColor(Component component, StateTransitionTracker.ModelStateInfo modelStateInfo, CoreColorTokenUtils.ContainerType inactiveContainerType) private static intgetInterpolatedChannelValue(int value1, int value2, double value1Likeness) static ColorgetInterpolatedColor(Color color1, Color color2, double color1Likeness) Interpolates color.static intgetInterpolatedRGB(Color color1, Color color2, double color1Likeness) Interpolates color.static ColorgetLighterColor(Color color, double diff) Returns lighter version of the specified color.static floatgetMenuComponentForegroundAlpha(JMenuItem menuComponent, StateTransitionTracker.ModelStateInfo modelStateInfo, CoreColorTokenUtils.ContainerType inactiveContainerType) static ColorgetMenuComponentForegroundColor(JMenuItem menuComponent, StateTransitionTracker.ModelStateInfo modelStateInfo, CoreColorTokenUtils.ContainerType inactiveContainerType) Returns the foreground text color of the specified menu component.static ColorgetSaturatedColor(Color color, double factor) Returns saturated version of the specified color.static ColorgetStripedBackground(JComponent component, int rowIndex) Returns the striped background for the specified component.private static doubleOECF_sRGB(double linear) static ColoroverlayColor(Color base, Color overlay)
-
Field Details
-
mutableContainerTokens
-
-
Constructor Details
-
RadianceColorUtilities
public RadianceColorUtilities()
-
-
Method Details
-
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.
-
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
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
-
getAlphaColor
-
getSaturatedColor
-
deriveByBrightness
-
getForegroundColor
Returns the foreground color of the specified color tokens.- Parameters:
colorTokens- Color tokens.- Returns:
- Color tokens foreground color.
-
getLighterColor
-
getDarkerColor
-
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.
-
getForegroundColor
public static Color getForegroundColor(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 Color getForegroundVariantColor(Component component, StateTransitionTracker.ModelStateInfo modelStateInfo, CoreColorTokenUtils.ContainerType inactiveContainerType) -
getForegroundAlpha
public static float getForegroundAlpha(Component component, StateTransitionTracker.ModelStateInfo modelStateInfo, CoreColorTokenUtils.ContainerType inactiveContainerType) -
getMenuComponentForegroundColor
public static Color getMenuComponentForegroundColor(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(JMenuItem menuComponent, StateTransitionTracker.ModelStateInfo modelStateInfo, CoreColorTokenUtils.ContainerType inactiveContainerType) -
getBackgroundFillColor
public static Color getBackgroundFillColor(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
-
getDefaultBackgroundColor
-
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
-