Module com.googlecode.lanterna
Package com.googlecode.lanterna.graphics
Class DefaultMutableThemeStyle
java.lang.Object
com.googlecode.lanterna.graphics.DefaultMutableThemeStyle
- All Implemented Interfaces:
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:
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionDefaultMutableThemeStyle
(ThemeStyle themeStyleToCopy) Creates a newDefaultMutableThemeStyle
based on an existingThemeStyle
.DefaultMutableThemeStyle
(TextColor foreground, TextColor background, SGR... sgrs) Creates a newDefaultMutableThemeStyle
with a specified style (foreground, background and SGR state)private
DefaultMutableThemeStyle
(TextColor foreground, TextColor background, EnumSet<SGR> sgrs) -
Method Summary
Modifier and TypeMethodDescriptionReturns the background color associated with this styleReturns the foreground color associated with this stylegetSGRs()
Returns the set of SGR flags associated with this style.setBackground
(TextColor background) Modifies the background color of thisDefaultMutableThemeStyle
to the value passed insetForeground
(TextColor foreground) Modifies the foreground color of thisDefaultMutableThemeStyle
to the value passed inModifies the SGR modifiers of thisDefaultMutableThemeStyle
to the values passed it.
-
Field Details
-
foreground
-
background
-
sgrs
-
-
Constructor Details
-
DefaultMutableThemeStyle
Creates a newDefaultMutableThemeStyle
based on an existingThemeStyle
. 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
Creates a newDefaultMutableThemeStyle
with a specified style (foreground, background and SGR state)- Parameters:
foreground
- Foreground color of the text with this stylebackground
- Background color of the text with this stylesgrs
- Modifiers to apply to the text with this style
-
DefaultMutableThemeStyle
-
-
Method Details
-
getForeground
Description copied from interface:ThemeStyle
Returns the foreground color associated with this style- Specified by:
getForeground
in interfaceThemeStyle
- Returns:
- foreground color associated with this style
-
getBackground
Description copied from interface:ThemeStyle
Returns the background color associated with this style- Specified by:
getBackground
in interfaceThemeStyle
- Returns:
- background color associated with this style
-
getSGRs
Description copied from interface:ThemeStyle
Returns the set of SGR flags associated with this style. ThisEnumSet
is either unmodifiable or a copy so altering it will not change the theme in any way.- Specified by:
getSGRs
in interfaceThemeStyle
- Returns:
- SGR flags associated with this style
-
setForeground
Modifies the foreground color of thisDefaultMutableThemeStyle
to the value passed in- Parameters:
foreground
- New foreground color for this theme style- Returns:
- Itself
-
setBackground
Modifies the background color of thisDefaultMutableThemeStyle
to the value passed in- Parameters:
background
- New background color for this theme style- Returns:
- Itself
-
setSGRs
Modifies the SGR modifiers of thisDefaultMutableThemeStyle
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
-