Package jexer.bits

Class ColorTheme


  • public class ColorTheme
    extends java.lang.Object
    ColorTheme is a collection of colors keyed by string. A default theme is also provided that matches the blue-and-white theme used by Turbo Vision.
    • Constructor Summary

      Constructors 
      Constructor Description
      ColorTheme()
      Public constructor sets the theme to the default.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      CellAttributes getColor​(java.lang.String name)
      Retrieve the CellAttributes for a named theme color.
      java.util.List<java.lang.String> getColorNames()
      Retrieve all the names in the theme.
      void load​(java.io.Reader reader)
      Read color theme mappings from a Reader.
      void load​(java.lang.String filename)
      Read color theme mappings from an ASCII file.
      void save​(java.lang.String filename)
      Save the color theme mappings to an ASCII file.
      void setColor​(java.lang.String name, CellAttributes color)
      Set the color for a named theme color.
      void setColorFromString​(java.lang.String key, java.lang.String text)
      Set a color based on a text string.
      void setDefaultTheme()
      Sets to defaults that resemble the Borland IDE colors.
      java.lang.String toString()
      Make human-readable description of this Cell.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ColorTheme

        public ColorTheme()
        Public constructor sets the theme to the default.
    • Method Detail

      • getColor

        public CellAttributes getColor​(java.lang.String name)
        Retrieve the CellAttributes for a named theme color.
        Parameters:
        name - theme color name, e.g. "twindow.border"
        Returns:
        color associated with name, e.g. bold yellow on blue
      • getColorNames

        public java.util.List<java.lang.String> getColorNames()
        Retrieve all the names in the theme.
        Returns:
        a list of names
      • setColor

        public void setColor​(java.lang.String name,
                             CellAttributes color)
        Set the color for a named theme color.
        Parameters:
        name - theme color name, e.g. "twindow.border"
        color - the new color to associate with name, e.g. bold yellow on blue
      • save

        public void save​(java.lang.String filename)
                  throws java.io.IOException
        Save the color theme mappings to an ASCII file.
        Parameters:
        filename - file to write to
        Throws:
        java.io.IOException - if the I/O fails
      • load

        public void load​(java.lang.String filename)
                  throws java.io.IOException
        Read color theme mappings from an ASCII file.
        Parameters:
        filename - file to read from
        Throws:
        java.io.IOException - if the I/O fails
      • setColorFromString

        public void setColorFromString​(java.lang.String key,
                                       java.lang.String text)
        Set a color based on a text string. Color text string is of the form: [ bold ] [ blink ] { foreground on background }
        Parameters:
        key - the color key string
        text - the text string
      • load

        public void load​(java.io.Reader reader)
                  throws java.io.IOException
        Read color theme mappings from a Reader. The reader is closed at the end.
        Parameters:
        reader - the reader to read from
        Throws:
        java.io.IOException - if the I/O fails
      • setDefaultTheme

        public void setDefaultTheme()
        Sets to defaults that resemble the Borland IDE colors.
      • toString

        public java.lang.String toString()
        Make human-readable description of this Cell.
        Overrides:
        toString in class java.lang.Object
        Returns:
        displayable String