/** * Allows subclasses to determine the best color resolver. This is typically used by color * scheme that wrap other color scheme, such as color shifting or color inversion. * * @param colorScheme * the color scheme to test * @return a resolver for the supplied color scheme */ protected static SchemeDerivedColorsResolver getResolver(SubstanceColorScheme colorScheme) { if (colorScheme instanceof BaseColorScheme) { return ((BaseColorScheme) colorScheme).derivedColorsResolver; } return colorScheme.isDark() ? DerivedColorsResolverDark.INSTANCE : DerivedColorsResolverLight.INSTANCE; }
/** * Creates the resolver of derived colors for the specified light color * scheme. * * @param scheme * The original color scheme. */ public DerivedColorsResolverLight(SubstanceColorScheme scheme) { if (scheme.isDark()) { throw new IllegalArgumentException("The scheme must be light: " + scheme.getDisplayName()); } this.scheme = scheme; }
/** * Creates the resolver of derived colors for the specified dark color * scheme. * * @param scheme * The original color scheme. */ public DerivedColorsResolverDark(SubstanceColorScheme scheme) { if (!scheme.isDark()) { throw new IllegalArgumentException("The scheme must be dark: " + scheme.getDisplayName()); } this.scheme = scheme; }
public static Icon getThemedIcon(JTabbedPane tab, int tabIndex, Icon orig) { SubstanceColorScheme colorScheme = SubstanceColorSchemeUtilities .getColorScheme(tab, tabIndex, ColorSchemeAssociationKind.TAB, ComponentState.ENABLED); float brightnessFactor = colorScheme.isDark() ? 0.2f : 0.8f; return new ImageIcon(SubstanceImageCreator.getColorSchemeImage(tab, orig, colorScheme, brightnessFactor)); }
public static Icon getThemedIcon(Component comp, Icon orig) { SubstanceColorScheme colorScheme = SubstanceColorSchemeUtilities .getColorScheme(comp, ComponentState.ENABLED); float brightnessFactor = colorScheme.isDark() ? 0.2f : 0.8f; return new ImageIcon(SubstanceImageCreator.getColorSchemeImage(comp, orig, colorScheme, brightnessFactor)); }
public static Icon getThemedIcon(Component comp, Icon orig) { SubstanceColorScheme colorScheme = SubstanceColorSchemeUtilities .getColorScheme(comp, ComponentState.ENABLED); float brightnessFactor = colorScheme.isDark() ? 0.2f : 0.8f; return new ImageIcon(SubstanceImageCreator.getColorSchemeImage(comp, orig, colorScheme, brightnessFactor)); }
public static Icon getThemedIcon(JTabbedPane tab, int tabIndex, Icon orig) { SubstanceColorScheme colorScheme = SubstanceColorSchemeUtilities .getColorScheme(tab, tabIndex, ColorSchemeAssociationKind.TAB, ComponentState.ENABLED); float brightnessFactor = colorScheme.isDark() ? 0.2f : 0.8f; return new ImageIcon(SubstanceImageCreator.getColorSchemeImage(tab, orig, colorScheme, brightnessFactor)); }
public static Color getSeparatorShadowColor(SubstanceColorScheme scheme) { return scheme.isDark() ? scheme.getDarkColor() : scheme .getUltraLightColor(); }
public static Color getSeparatorLightColor(SubstanceColorScheme scheme) { return scheme.isDark() ? scheme.getLightColor() : SubstanceColorUtilities.getInterpolatedColor(scheme .getLightColor(), scheme.getDarkColor(), 0.8); }
public static Color getSeparatorDarkColor(SubstanceColorScheme scheme) { return scheme.isDark() ? scheme.getExtraLightColor() : SubstanceColorUtilities.getInterpolatedColor(scheme .getMidColor(), scheme.getDarkColor(), 0.4); }
/** * Returns the shadow color for the specified component. * * @param c * Component. * @return Matching shadow color. */ public Color getShadowColor(Component c) { SubstanceColorScheme colorScheme = SubstanceColorSchemeUtilities .getColorScheme(c, ColorSchemeAssociationKind.SEPARATOR, ComponentState.ENABLED); Color back = colorScheme.isDark() ? colorScheme.getDarkColor() : colorScheme.getUltraLightColor(); return SubstanceColorUtilities.getAlphaColor(back, 196); }
/** * Returns the shadow color for the specified component. * * @param c * Component. * @return Matching shadow color. */ public Color getShadowColor(Component c) { SubstanceColorScheme colorScheme = SubstanceColorSchemeUtilities .getColorScheme(c, ColorSchemeAssociationKind.SEPARATOR, ComponentState.ENABLED); Color back = colorScheme.isDark() ? colorScheme.getDarkColor() : colorScheme.getUltraLightColor(); return SubstanceColorUtilities.getAlphaColor(back, 196); }
@Override protected void paintContentBorder(Graphics g, int tabPlacement, int selectedIndex) { SubstanceColorScheme scheme = SubstanceColorSchemeUtilities .getColorScheme(this.tabPane, selectedIndex, ColorSchemeAssociationKind.TAB, ComponentState.ENABLED); this.highlight = scheme.isDark() ? SubstanceColorUtilities .getAlphaColor(scheme.getUltraDarkColor(), 100) : scheme .getLightColor(); super.paintContentBorder(g, tabPlacement, selectedIndex); }
@Override protected void paintContentBorder(Graphics g, int tabPlacement, int selectedIndex) { SubstanceColorScheme scheme = SubstanceColorSchemeUtilities .getColorScheme(this.tabPane, selectedIndex, ColorSchemeAssociationKind.TAB, ComponentState.ENABLED); this.highlight = scheme.isDark() ? SubstanceColorUtilities .getAlphaColor(scheme.getUltraDarkColor(), 100) : scheme .getLightColor(); super.paintContentBorder(g, tabPlacement, selectedIndex); }
public CopyMutableColorScheme(String name, SubstanceColorScheme copy) { super(name, copy.isDark()); foregroundColor = copy.getForegroundColor(); ultraLightColor = copy.getUltraLightColor(); extraLightColor = copy.getExtraLightColor(); lightColor = copy.getLightColor(); midColor = copy.getMidColor(); darkColor = copy.getDarkColor(); ultraDarkColor = copy.getUltraDarkColor(); }
/** * 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); }
/** * 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); }
/** * Creates a new inverted scheme. * * @param origScheme * The original color scheme. */ public NegatedColorScheme(SubstanceColorScheme origScheme) { super("Negated " + origScheme.getDisplayName(), !origScheme.isDark()); this.origScheme = origScheme; this.foregroundColor = SubstanceColorUtilities.invertColor(origScheme .getForegroundColor()); this.mainUltraDarkColor = SubstanceColorUtilities .invertColor(origScheme.getUltraDarkColor()); this.mainDarkColor = SubstanceColorUtilities.invertColor(origScheme .getDarkColor()); this.mainMidColor = SubstanceColorUtilities.invertColor(origScheme .getMidColor()); this.mainLightColor = SubstanceColorUtilities.invertColor(origScheme .getLightColor()); this.mainExtraLightColor = SubstanceColorUtilities .invertColor(origScheme.getExtraLightColor()); this.mainUltraLightColor = SubstanceColorUtilities .invertColor(origScheme.getUltraLightColor()); }
/** * Creates a new hue-shifted color scheme. * * @param origScheme * The original color scheme. * @param hueShiftFactor * Shift factor. Should be in -1.0-1.0 range. */ public HueShiftColorScheme(SubstanceColorScheme origScheme, double hueShiftFactor) { super("Hue-shift " + origScheme.getDisplayName() + " " + (int) (100 * hueShiftFactor) + "%", origScheme.isDark()); this.hueShiftFactor = hueShiftFactor; this.origScheme = origScheme; this.foregroundColor = SubstanceColorUtilities.getHueShiftedColor( origScheme.getForegroundColor(), this.hueShiftFactor / 2.0); this.mainUltraDarkColor = SubstanceColorUtilities.getHueShiftedColor( origScheme.getUltraDarkColor(), this.hueShiftFactor); this.mainDarkColor = SubstanceColorUtilities.getHueShiftedColor( origScheme.getDarkColor(), this.hueShiftFactor); this.mainMidColor = SubstanceColorUtilities.getHueShiftedColor( origScheme.getMidColor(), this.hueShiftFactor); this.mainLightColor = SubstanceColorUtilities.getHueShiftedColor( origScheme.getLightColor(), this.hueShiftFactor); this.mainExtraLightColor = SubstanceColorUtilities.getHueShiftedColor( origScheme.getExtraLightColor(), this.hueShiftFactor); this.mainUltraLightColor = SubstanceColorUtilities.getHueShiftedColor( origScheme.getUltraLightColor(), this.hueShiftFactor); }
/** * Creates a new inverted scheme. * * @param origScheme * The original color scheme. */ public InvertedColorScheme(SubstanceColorScheme origScheme) { super("Inverted " + origScheme.getDisplayName(), !origScheme.isDark()); this.origScheme = origScheme; this.foregroundColor = SubstanceColorUtilities.invertColor(origScheme .getForegroundColor()); this.mainUltraDarkColor = SubstanceColorUtilities .invertColor(origScheme.getUltraLightColor()); this.mainDarkColor = SubstanceColorUtilities.invertColor(origScheme .getExtraLightColor()); this.mainMidColor = SubstanceColorUtilities.invertColor(origScheme .getLightColor()); this.mainLightColor = SubstanceColorUtilities.invertColor(origScheme .getMidColor()); this.mainExtraLightColor = SubstanceColorUtilities .invertColor(origScheme.getDarkColor()); this.mainUltraLightColor = SubstanceColorUtilities .invertColor(origScheme.getUltraDarkColor()); }