.getMenuComponentForegroundColor(menuComponent, modelStateInfo); .getBackgroundFillColor(menuComponent); fgColor = SubstanceColorUtilities.getInterpolatedColor(fgColor, bgFillColor, textAlpha);
.getAlphaColor(scheme.getForegroundColor(), 32)); this.addOverlayPainter(toolbarTopLineOverlayPainter, DecorationAreaType.TOOLBAR); (SubstanceColorScheme scheme) -> scheme.getUltraDarkColor().darker(), (SubstanceColorScheme scheme) -> SubstanceColorUtilities .getAlphaColor(scheme.getForegroundColor(), 32)); this.addOverlayPainter(footerTopBezelOverlayPainter, DecorationAreaType.FOOTER);
int end = (3 * iSize / 4);// - 1; int size = end - start - 3; Color color = SubstanceColorUtilities.getMarkColor(scheme, true); graphics.setColor(color); graphics.fillRect(start + 2, end - 2, size, 3); int fgStrength = SubstanceColorUtilities.getColorBrightness(color .getRGB()); int fgNegativeStrength = SubstanceColorUtilities .getColorBrightness(SubstanceColorUtilities .getNegativeColor(color.getRGB())); int bgStrength = SubstanceColorUtilities .getColorBrightness(backgroundScheme.getLightColor().getRGB()); boolean noEcho = (fgStrength > fgNegativeStrength) && (fgStrength < bgStrength); noEcho ? 0 : SubstanceColorUtilities.getColorStrength(color), 1, 1));
/** * Returns the color strength. * * @param color * Color. * @return Color strength. */ public static float getColorStrength(Color color) { return Math.max(getColorBrightness(color.getRGB()), getColorBrightness(getNegativeColor(color.getRGB()))) / 255.0f; }
return null; Color fgColor = SubstanceColorUtilities.getMenuItemForegroundColor( menuItem, modelStateInfo); .getBackgroundFillColor(menuItem); fgColor = SubstanceColorUtilities.getInterpolatedColor(fgColor, bgFillColor, textAlpha);
@Override public Color getTopFillColor(SubstanceColorScheme fillScheme) { return SubstanceColorUtilities.getInterpolatedColor(super .getTopFillColor(fillScheme), this .getMidFillColorTop(fillScheme), 0.3); } }
@Override protected Color getSelectionForeground() { ComponentState progressState = getProgressState(); SubstanceColorScheme scheme = SubstanceColorSchemeUtilities .getColorScheme(progressBar, progressState); return SubstanceColorUtilities.getForegroundColor(scheme); }
Color lightColor = SubstanceColorUtilities.getDefaultBackgroundColor(c, stateForOuterBorder); float alpha = SubstanceColorSchemeUtilities.getAlpha(c, stateForOuterBorder); lightColor = SubstanceColorUtilities.getAlphaColor(lightColor, (int) (255 * alpha)); .getOuterTextComponentBorderColor(lightColor); float[] hsb = Color.RGBtoHSB(lightColor.getRed(), lightColor.getGreen(), lightColor.getBlue(), null); Color topInnerColor = SubstanceColorUtilities.getInterpolatedColor( darkColor, lightColor, topInnerBlend); Color bottomInnerColor = SubstanceColorUtilities.getInterpolatedColor( lightColor, darkColor, bottomInnerBlend);
public static Color getTextBackgroundFillColor(JComponent comp) { Color backgroundFillColor = SubstanceColorUtilities .getBackgroundFillColor(comp); JTextComponent componentForTransitions = SubstanceCoreUtilities .getTextComponentForTransitions(comp); if (componentForTransitions != null) { ComponentUI ui = componentForTransitions.getUI(); if (ui instanceof TransitionAwareUI) { TransitionAwareUI trackable = (TransitionAwareUI) ui; StateTransitionTracker stateTransitionTracker = trackable .getTransitionTracker(); Color outerTextComponentBorderColor = SubstanceColorUtilities .getOuterTextComponentBorderColor(backgroundFillColor); outerTextComponentBorderColor = SubstanceColorUtilities .getInterpolatedColor(outerTextComponentBorderColor, backgroundFillColor, 0.6); float selectionStrength = stateTransitionTracker .getFacetStrength(ComponentStateFacet.SELECTION); float rolloverStrength = stateTransitionTracker .getFacetStrength(ComponentStateFacet.ROLLOVER); backgroundFillColor = SubstanceColorUtilities .getInterpolatedColor(outerTextComponentBorderColor, backgroundFillColor, Math.max( selectionStrength, rolloverStrength)); } } return backgroundFillColor; }
@Override public void paintOverlay(Graphics2D graphics, Component comp, DecorationAreaType decorationAreaType, int width, int height, SubstanceSkin skin) { Color shadowColor = SubstanceColorUtilities .getBackgroundFillColor(comp).darker(); // need to handle components "embedded" in other components Component topMostWithSameDecorationAreaType = SubstancePainterUtils .getTopMostParentWithDecorationAreaType(comp, decorationAreaType); Point inTopMost = SwingUtilities.convertPoint(comp, new Point(0, 0), topMostWithSameDecorationAreaType); int dy = inTopMost.y; Graphics2D g2d = (Graphics2D) graphics.create(); g2d.translate(0, -dy); g2d.setPaint(new GradientPaint(0, 0, SubstanceColorUtilities .getAlphaColor(shadowColor, 160), 0, 4, SubstanceColorUtilities .getAlphaColor(shadowColor, 16))); g2d.fillRect(0, 0, comp.getWidth(), 4); g2d.dispose(); }
/** * Returns the highlight color for the specified component. * * @param c * Component. * @return Matching highlight color. */ public Color getHighlightColor(Component c) { SubstanceColorScheme colorScheme = SubstanceColorSchemeUtilities .getColorScheme(c, ColorSchemeAssociationKind.SEPARATOR, ComponentState.ENABLED); boolean isDark = colorScheme.isDark(); Color foreDark = isDark ? colorScheme.getExtraLightColor() : SubstanceColorUtilities.getInterpolatedColor(colorScheme .getMidColor(), colorScheme.getDarkColor(), 0.4); return SubstanceColorUtilities.getAlphaColor(foreDark, 196); }
.getBackgroundFillColor(component); fgColor = SubstanceColorUtilities.getInterpolatedColor(fgColor, bgFillColor, textAlpha);
this.origScheme = origScheme; this.foregroundColor = (this.foregroundShiftColor != null) ? SubstanceColorUtilities .getInterpolatedColor(this.foregroundShiftColor, origScheme .getForegroundColor(), this.foregroundShiftFactor) : origScheme.getForegroundColor(); && (this.backgroundShiftColor != null); Color ultraDarkToShiftTo = shiftByBrightness ? SubstanceColorUtilities .deriveByBrightness(this.backgroundShiftColor, origScheme .getUltraDarkColor()) : this.backgroundShiftColor; this.mainUltraDarkColor = (this.backgroundShiftColor != null) ? SubstanceColorUtilities .getInterpolatedColor(ultraDarkToShiftTo, origScheme .getUltraDarkColor(), this.backgroundShiftFactor) : origScheme.getUltraDarkColor(); Color darkToShiftTo = shiftByBrightness ? SubstanceColorUtilities .deriveByBrightness(this.backgroundShiftColor, origScheme .getDarkColor()) : this.backgroundShiftColor; this.mainDarkColor = (this.backgroundShiftColor != null) ? SubstanceColorUtilities .getInterpolatedColor(darkToShiftTo, origScheme.getDarkColor(), this.backgroundShiftFactor) : origScheme.getDarkColor(); Color midToShiftTo = shiftByBrightness ? SubstanceColorUtilities .deriveByBrightness(this.backgroundShiftColor, origScheme .getMidColor()) : this.backgroundShiftColor; this.mainMidColor = (this.backgroundShiftColor != null) ? SubstanceColorUtilities .getInterpolatedColor(midToShiftTo, origScheme.getMidColor(), this.backgroundShiftFactor) : origScheme.getMidColor(); Color lightToShiftTo = shiftByBrightness ? SubstanceColorUtilities
.getColorStrength(foregroundColor); gBlurred.setColor(SubstanceColorUtilities .getNegativeColor(foregroundColor)); ConvolveOp convolve = new ConvolveOp(new Kernel(3, 3, new float[] { .02f, .05f, .02f, .05f, .02f, .05f, .02f, .05f, .02f }),
.getDisabledColorScheme(DecorationAreaType.NONE); Color foregroundColor = SubstanceColorUtilities .getForegroundColor(mainEnabledScheme); Color backgroundColor = new ColorUIResource(mainActiveScheme .getBackgroundFillColor()); Color disabledForegroundColor = SubstanceColorUtilities .getForegroundColor(mainDisabledScheme); .getEnabledColorScheme(DecorationAreaType.HEADER); Color titlePaneForeground = new ColorUIResource(SubstanceColorUtilities .getForegroundColor(headerDecorationTheme)); .getNegativeColor(foregroundColor)),
ComponentState.SELECTED); Color darkShadowColor = SubstanceColorUtilities .getMidBorderColor(borderScheme); if (isUnbroken) { g2d.setColor(this.highlight); .getAlphaColor(darkShadowColor, 0))); g2d.draw(bottomOutline);
/** * 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. * * @param component * Component. * @param rowIndex * Row index. * @return The striped background for the specified component. */ public static Color getStripedBackground(JComponent component, int rowIndex) { Color backgr = getBackgroundFillColor(component); if (backgr == null) return null; if (rowIndex % 2 == 0) return backgr; int r = backgr.getRed(); int g = backgr.getGreen(); int b = backgr.getBlue(); double coef = 0.96; if (!component.isEnabled()) coef = 1.0 - (1.0 - coef) / 2.0; Color darkerColor = new ColorUIResource((int) (coef * r), (int) (coef * g), (int) (coef * b)); return darkerColor; }
private void negateColor(int[] pixels) { for (int i = 0; i < pixels.length; i++) { int argb = pixels[i]; pixels[i] = SubstanceColorUtilities.getNegativeColor(argb); } } }
/** * Returns the color of the top portion of shine in control backgrounds. * * @return The color of the top portion of shine in control backgrounds. */ public static Color getTopShineColor(SubstanceColorScheme scheme) { return getBottomFillColor(scheme); }