Class PropertyTheme

java.lang.Object
com.googlecode.lanterna.graphics.AbstractTheme
com.googlecode.lanterna.graphics.PropertyTheme
All Implemented Interfaces:
Theme
Direct Known Subclasses:
DefaultTheme

public class PropertyTheme extends AbstractTheme
Theme implementation that stores the theme definition in a regular java Properties object. The format is:
     foreground = black
     background = white
     sgr =
     com.mypackage.mycomponent.MyClass.foreground = yellow
     com.mypackage.mycomponent.MyClass.background = white
     com.mypackage.mycomponent.MyClass.sgr =
     com.mypackage.mycomponent.MyClass.foreground[ACTIVE] = red
     com.mypackage.mycomponent.MyClass.background[ACTIVE] = black
     com.mypackage.mycomponent.MyClass.sgr[ACTIVE] = bold
     ...
 
See the documentation on Theme for further information about different style categories that can be assigned. The foreground, background and sgr entries without a class specifier will be tied to the global fallback and is used if the libraries tries to apply a theme style that isn't specified in the Properties object and there is no other superclass specified either.
  • Constructor Details

    • PropertyTheme

      public PropertyTheme(Properties properties)
      Creates a new PropertyTheme that is initialized by the properties passed in. If the properties refer to a class that cannot be resolved, it will throw IllegalArgumentException.
      Parameters:
      properties - Properties to initialize this theme with
    • PropertyTheme

      public PropertyTheme(Properties properties, boolean ignoreUnknownClasses)
      Creates a new PropertyTheme that is initialized by the properties value and optionally prevents it from throwing an exception if there are invalid definitions in the properties object.
      Parameters:
      properties - Properties to initialize this theme with
      ignoreUnknownClasses - If true, will not throw an exception if there is an invalid entry in the properties object
  • Method Details

    • getDefinition

      private String getDefinition(String propertyName)
    • getStyle

      private String getStyle(String propertyName)