Class BaseColorScheme
- java.lang.Object
-
- org.pushingpixels.substance.api.colorscheme.BaseColorScheme
-
- All Implemented Interfaces:
SchemeBaseColors,SchemeDerivedColors,SubstanceColorScheme,SubstanceTrait
- Direct Known Subclasses:
BaseDarkColorScheme,BaseLightColorScheme,BlendBiColorScheme,HueShiftColorScheme,InvertedColorScheme,NegatedColorScheme,SaturatedColorScheme,ShiftColorScheme
public abstract class BaseColorScheme extends Object implements SubstanceColorScheme
Base class for Substance color schemes.
-
-
Field Summary
Fields Modifier and Type Field Description protected SchemeDerivedColorsResolverderivedColorsResolverResolver for the derived colors.protected StringdisplayNameDisplay name of this color scheme.protected booleanisDarkIndicates whether this color scheme is dark.
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseColorScheme(String displayName, boolean isDark)Constructs the basic functionality of a color scheme.protectedBaseColorScheme(String displayName, SchemeDerivedColorsResolver derivedColorsResolver)Constructs the basic functionality of a color scheme.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ColorgetBackgroundFillColor()Returns the background fill color forthisscheme.StringgetDisplayName()Returns the display name ofthistrait.ColorgetFocusRingColor()Returns the focus ring color forthisscheme.ColorgetLineColor()Returns the line color forthisscheme.protected static SchemeDerivedColorsResolvergetResolver(SubstanceColorScheme colorScheme)Allows subclasses to determine the best color resolver.ColorgetSelectionBackgroundColor()Returns the selection background color forthisscheme.ColorgetSelectionForegroundColor()Returns the selection foreground color forthisscheme.ColorgetTextBackgroundFillColor()Returns the text background fill color forthisscheme.ColorgetWatermarkDarkColor()Returns the watermark dark color forthisscheme.ColorgetWatermarkLightColor()Returns the watermark light color forthisscheme.ColorgetWatermarkStampColor()Returns the watermark stamp color forthisscheme.SubstanceColorSchemehueShift(double hueShiftFactor)Creates a hue-shifted (in HSB space) version ofthiscolor scheme.SubstanceColorSchemeinvert()Creates an inverted version ofthisscheme.booleanisDark()Returns indication whether this color scheme uses dark colors.SubstanceColorSchemenamed(String colorSchemeDisplayName)This method is a fluent-interface builder utility for setting the display name for this color scheme.SubstanceColorSchemenegate()Creates a negated version ofthisscheme.SubstanceColorSchemesaturate(double saturateFactor)Creates a saturated or desaturated version ofthisscheme.SubstanceColorSchemeshade(double shadeFactor)Creates a shaded (shifted towards black) version ofthiscolor scheme.SubstanceColorSchemeshift(Color backgroundShiftColor, double backgroundShiftFactor, Color foregroundShiftColor, double foregroundShiftFactor)Creates a shift version ofthisscheme.SubstanceColorSchemeshiftBackground(Color backgroundShiftColor, double backgroundShiftFactor)Creates a shift version ofthisscheme.SubstanceColorSchemetint(double tintFactor)Creates a tinted (shifted towards white) version ofthiscolor scheme.SubstanceColorSchemetone(double toneFactor)Creates a toned (shifted towards gray) version ofthiscolor scheme.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.pushingpixels.substance.api.SchemeBaseColors
getDarkColor, getExtraLightColor, getForegroundColor, getLightColor, getMidColor, getUltraDarkColor, getUltraLightColor
-
-
-
-
Field Detail
-
isDark
protected boolean isDark
Indicates whether this color scheme is dark.
-
displayName
protected String displayName
Display name of this color scheme.
-
derivedColorsResolver
protected SchemeDerivedColorsResolver derivedColorsResolver
Resolver for the derived colors.
-
-
Constructor Detail
-
BaseColorScheme
protected BaseColorScheme(String displayName, boolean isDark)
Constructs the basic functionality of a color scheme.- Parameters:
displayName- Display name.isDark- Indication whether the color scheme is dark.
-
BaseColorScheme
protected BaseColorScheme(String displayName, SchemeDerivedColorsResolver derivedColorsResolver)
Constructs the basic functionality of a color scheme.Subclasses should typically invoke this constructor.
- Parameters:
displayName- Display name.derivedColorsResolver- A resolver that determine how derived colors are derived- Throws:
NullPointerException- ifderivedColorsResolverisnull
-
-
Method Detail
-
getResolver
protected static SchemeDerivedColorsResolver getResolver(SubstanceColorScheme colorScheme)
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.- Parameters:
colorScheme- the color scheme to test- Returns:
- a resolver for the supplied color scheme
-
getDisplayName
public final String getDisplayName()
Description copied from interface:SubstanceTraitReturns the display name ofthistrait. This method is part of officially supported API.- Specified by:
getDisplayNamein interfaceSubstanceTrait- Returns:
- The display name of
thistrait.
-
isDark
public final boolean isDark()
Description copied from interface:SubstanceColorSchemeReturns indication whether this color scheme uses dark colors. Note that this method may be removed in the future.- Specified by:
isDarkin interfaceSubstanceColorScheme- Returns:
trueif this color scheme uses dark colors,falseotherwise.
-
shift
public final SubstanceColorScheme shift(Color backgroundShiftColor, double backgroundShiftFactor, Color foregroundShiftColor, double foregroundShiftFactor)
Description copied from interface:SubstanceColorSchemeCreates a shift version ofthisscheme.- Specified by:
shiftin interfaceSubstanceColorScheme- Parameters:
backgroundShiftColor- Shift color for background colors. Should have full opacity.backgroundShiftFactor- Value in 0.0...1.0 range. Larger values shift more towards the specified color.foregroundShiftColor- Shift color for foreground colors. Should have full opacity.foregroundShiftFactor- Value in 0.0...1.0 range. Larger values shift more towards the specified color.- Returns:
- Shift version of
thisscheme.
-
shiftBackground
public final SubstanceColorScheme shiftBackground(Color backgroundShiftColor, double backgroundShiftFactor)
Description copied from interface:SubstanceColorSchemeCreates a shift version ofthisscheme.- Specified by:
shiftBackgroundin interfaceSubstanceColorScheme- Parameters:
backgroundShiftColor- Shift color for background colors. Should have full opacity.backgroundShiftFactor- Value in 0.0...1.0 range. Larger values shift more towards the specified color.- Returns:
- Shift version of
thisscheme that does not change the foreground color.
-
tint
public SubstanceColorScheme tint(double tintFactor)
Description copied from interface:SubstanceColorSchemeCreates a tinted (shifted towards white) version ofthiscolor scheme.- Specified by:
tintin interfaceSubstanceColorScheme- Parameters:
tintFactor- Value in 0.0...1.0 range. Larger values shift more towards white color.- Returns:
- Tinted version of
thisscheme.
-
tone
public SubstanceColorScheme tone(double toneFactor)
Description copied from interface:SubstanceColorSchemeCreates a toned (shifted towards gray) version ofthiscolor scheme.- Specified by:
tonein interfaceSubstanceColorScheme- Parameters:
toneFactor- Value in 0.0...1.0 range. Larger values shift more towards gray color.- Returns:
- Toned version of
thisscheme.
-
shade
public SubstanceColorScheme shade(double shadeFactor)
Description copied from interface:SubstanceColorSchemeCreates a shaded (shifted towards black) version ofthiscolor scheme.- Specified by:
shadein interfaceSubstanceColorScheme- Parameters:
shadeFactor- Value in 0.0...1.0 range. Larger values shift more towards black color.- Returns:
- Shaded version of
thisscheme.
-
saturate
public SubstanceColorScheme saturate(double saturateFactor)
Description copied from interface:SubstanceColorSchemeCreates a saturated or desaturated version ofthisscheme. The value and brightness stay the same.- Specified by:
saturatein interfaceSubstanceColorScheme- Parameters:
saturateFactor- Value in -1.0...1.0 range. Positive values create more saturated colors. Negative values create more desaturated colors.- Returns:
- Saturated version of
thisscheme.
-
invert
public SubstanceColorScheme invert()
Description copied from interface:SubstanceColorSchemeCreates an inverted version ofthisscheme.- Specified by:
invertin interfaceSubstanceColorScheme- Returns:
- Inverted version of
thisscheme.
-
negate
public SubstanceColorScheme negate()
Description copied from interface:SubstanceColorSchemeCreates a negated version ofthisscheme.- Specified by:
negatein interfaceSubstanceColorScheme- Returns:
- Negated version of
thisscheme.
-
hueShift
public SubstanceColorScheme hueShift(double hueShiftFactor)
Description copied from interface:SubstanceColorSchemeCreates a hue-shifted (in HSB space) version ofthiscolor scheme.- Specified by:
hueShiftin interfaceSubstanceColorScheme- Parameters:
hueShiftFactor- Value in -1.0...1.0 range.- Returns:
- Hue-shifted version of
thisscheme.
-
getBackgroundFillColor
public final Color getBackgroundFillColor()
Description copied from interface:SchemeDerivedColorsReturns the background fill color forthisscheme.- Specified by:
getBackgroundFillColorin interfaceSchemeDerivedColors- Returns:
- The background fill color for
thisscheme.
-
getFocusRingColor
public final Color getFocusRingColor()
Description copied from interface:SchemeDerivedColorsReturns the focus ring color forthisscheme.- Specified by:
getFocusRingColorin interfaceSchemeDerivedColors- Returns:
- The focus ring color for
thisscheme.
-
getLineColor
public final Color getLineColor()
Description copied from interface:SchemeDerivedColorsReturns the line color forthisscheme.- Specified by:
getLineColorin interfaceSchemeDerivedColors- Returns:
- The line color for
thisscheme.
-
getSelectionForegroundColor
public final Color getSelectionForegroundColor()
Description copied from interface:SchemeDerivedColorsReturns the selection foreground color forthisscheme.- Specified by:
getSelectionForegroundColorin interfaceSchemeDerivedColors- Returns:
- The selection foreground color for
thisscheme.
-
getSelectionBackgroundColor
public final Color getSelectionBackgroundColor()
Description copied from interface:SchemeDerivedColorsReturns the selection background color forthisscheme.- Specified by:
getSelectionBackgroundColorin interfaceSchemeDerivedColors- Returns:
- The selection background color for
thisscheme.
-
getWatermarkDarkColor
public final Color getWatermarkDarkColor()
Description copied from interface:SchemeDerivedColorsReturns the watermark dark color forthisscheme.- Specified by:
getWatermarkDarkColorin interfaceSchemeDerivedColors- Returns:
- Watermark dark color for
thisscheme.
-
getWatermarkLightColor
public final Color getWatermarkLightColor()
Description copied from interface:SchemeDerivedColorsReturns the watermark light color forthisscheme.- Specified by:
getWatermarkLightColorin interfaceSchemeDerivedColors- Returns:
- Watermark light color for
thisscheme.
-
getWatermarkStampColor
public final Color getWatermarkStampColor()
Description copied from interface:SchemeDerivedColorsReturns the watermark stamp color forthisscheme.- Specified by:
getWatermarkStampColorin interfaceSchemeDerivedColors- Returns:
- Watermark stamp color for
thisscheme.
-
getTextBackgroundFillColor
public final Color getTextBackgroundFillColor()
Description copied from interface:SchemeDerivedColorsReturns the text background fill color forthisscheme.- Specified by:
getTextBackgroundFillColorin interfaceSchemeDerivedColors- Returns:
- The text background fill color for
thisscheme.
-
named
public final SubstanceColorScheme named(String colorSchemeDisplayName)
Description copied from interface:SubstanceColorSchemeThis method is a fluent-interface builder utility for setting the display name for this color scheme. The implementation must return the samethisinstance.- Specified by:
namedin interfaceSubstanceColorScheme- Parameters:
colorSchemeDisplayName- New display name for this color scheme.- Returns:
- This color scheme.
-
-