Class BaseColorScheme

    • Field Detail

      • isDark

        protected boolean isDark
        Indicates whether this color scheme is dark.
      • displayName

        protected String displayName
        Display name of this color scheme.
    • 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 - if derivedColorsResolver is null
    • 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: SubstanceTrait
        Returns the display name of this trait. This method is part of officially supported API.
        Specified by:
        getDisplayName in interface SubstanceTrait
        Returns:
        The display name of this trait.
      • isDark

        public final boolean isDark()
        Description copied from interface: SubstanceColorScheme
        Returns indication whether this color scheme uses dark colors. Note that this method may be removed in the future.
        Specified by:
        isDark in interface SubstanceColorScheme
        Returns:
        true if this color scheme uses dark colors, false otherwise.
      • shift

        public final SubstanceColorScheme shift​(Color backgroundShiftColor,
                                                double backgroundShiftFactor,
                                                Color foregroundShiftColor,
                                                double foregroundShiftFactor)
        Description copied from interface: SubstanceColorScheme
        Creates a shift version of this scheme.
        Specified by:
        shift in interface SubstanceColorScheme
        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 this scheme.
      • shiftBackground

        public final SubstanceColorScheme shiftBackground​(Color backgroundShiftColor,
                                                          double backgroundShiftFactor)
        Description copied from interface: SubstanceColorScheme
        Creates a shift version of this scheme.
        Specified by:
        shiftBackground in interface SubstanceColorScheme
        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 this scheme that does not change the foreground color.
      • tint

        public SubstanceColorScheme tint​(double tintFactor)
        Description copied from interface: SubstanceColorScheme
        Creates a tinted (shifted towards white) version of this color scheme.
        Specified by:
        tint in interface SubstanceColorScheme
        Parameters:
        tintFactor - Value in 0.0...1.0 range. Larger values shift more towards white color.
        Returns:
        Tinted version of this scheme.
      • tone

        public SubstanceColorScheme tone​(double toneFactor)
        Description copied from interface: SubstanceColorScheme
        Creates a toned (shifted towards gray) version of this color scheme.
        Specified by:
        tone in interface SubstanceColorScheme
        Parameters:
        toneFactor - Value in 0.0...1.0 range. Larger values shift more towards gray color.
        Returns:
        Toned version of this scheme.
      • shade

        public SubstanceColorScheme shade​(double shadeFactor)
        Description copied from interface: SubstanceColorScheme
        Creates a shaded (shifted towards black) version of this color scheme.
        Specified by:
        shade in interface SubstanceColorScheme
        Parameters:
        shadeFactor - Value in 0.0...1.0 range. Larger values shift more towards black color.
        Returns:
        Shaded version of this scheme.
      • saturate

        public SubstanceColorScheme saturate​(double saturateFactor)
        Description copied from interface: SubstanceColorScheme
        Creates a saturated or desaturated version of this scheme. The value and brightness stay the same.
        Specified by:
        saturate in interface SubstanceColorScheme
        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 this scheme.
      • hueShift

        public SubstanceColorScheme hueShift​(double hueShiftFactor)
        Description copied from interface: SubstanceColorScheme
        Creates a hue-shifted (in HSB space) version of this color scheme.
        Specified by:
        hueShift in interface SubstanceColorScheme
        Parameters:
        hueShiftFactor - Value in -1.0...1.0 range.
        Returns:
        Hue-shifted version of this scheme.
      • named

        public final SubstanceColorScheme named​(String colorSchemeDisplayName)
        Description copied from interface: SubstanceColorScheme
        This method is a fluent-interface builder utility for setting the display name for this color scheme. The implementation must return the same this instance.
        Specified by:
        named in interface SubstanceColorScheme
        Parameters:
        colorSchemeDisplayName - New display name for this color scheme.
        Returns:
        This color scheme.