Class DefaultMutableThemeStyle

  • All Implemented Interfaces:
    ThemeStyle

    public class DefaultMutableThemeStyle
    extends java.lang.Object
    implements ThemeStyle
    This basic implementation of ThemeStyle keeps the styles in its internal state and allows you to mutate them. It can be used to more easily override an existing theme and make small changes programmatically to it, see Issue409 in the test section for an example of how to do this.
    See Also:
    DelegatingThemeDefinition, DelegatingTheme, Theme
    • Field Detail

      • sgrs

        private java.util.EnumSet<SGR> sgrs
    • Constructor Detail

      • DefaultMutableThemeStyle

        public DefaultMutableThemeStyle​(ThemeStyle themeStyleToCopy)
        Creates a new DefaultMutableThemeStyle based on an existing ThemeStyle. The values of this style that is passed in will be copied into the new object that is created.
        Parameters:
        themeStyleToCopy - ThemeStyle object to copy the style parameters from
      • DefaultMutableThemeStyle

        public DefaultMutableThemeStyle​(TextColor foreground,
                                        TextColor background,
                                        SGR... sgrs)
        Creates a new DefaultMutableThemeStyle with a specified style (foreground, background and SGR state)
        Parameters:
        foreground - Foreground color of the text with this style
        background - Background color of the text with this style
        sgrs - Modifiers to apply to the text with this style
      • DefaultMutableThemeStyle

        private DefaultMutableThemeStyle​(TextColor foreground,
                                         TextColor background,
                                         java.util.EnumSet<SGR> sgrs)
    • Method Detail

      • getForeground

        public TextColor getForeground()
        Description copied from interface: ThemeStyle
        Returns the foreground color associated with this style
        Specified by:
        getForeground in interface ThemeStyle
        Returns:
        foreground color associated with this style
      • getBackground

        public TextColor getBackground()
        Description copied from interface: ThemeStyle
        Returns the background color associated with this style
        Specified by:
        getBackground in interface ThemeStyle
        Returns:
        background color associated with this style
      • getSGRs

        public java.util.EnumSet<SGR> getSGRs()
        Description copied from interface: ThemeStyle
        Returns the set of SGR flags associated with this style. This EnumSet is either unmodifiable or a copy so altering it will not change the theme in any way.
        Specified by:
        getSGRs in interface ThemeStyle
        Returns:
        SGR flags associated with this style
      • setSGRs

        public DefaultMutableThemeStyle setSGRs​(java.util.EnumSet<SGR> sgrs)
        Modifies the SGR modifiers of this DefaultMutableThemeStyle to the values passed it.
        Parameters:
        sgrs - New SGR modifiers for this theme style, the values in this set will be copied into the internal state
        Returns:
        Itself