Class Style


  • public final class Style
    extends java.lang.Object
    An immutable text styling value; setters return new instances and instances compare by value.
    • Field Detail

      • NORMAL

        public static final Style NORMAL
        Default foreground and background with no attributes.
      • REVERSE

        public static final Style REVERSE
        Inverted foreground and background.
      • DIM_REVERSE

        public static final Style DIM_REVERSE
        Dimmed inverse.
      • BOLD

        public static final Style BOLD
        Bold attribute.
      • DIM

        public static final Style DIM
        Dim attribute.
      • UNDERLINE

        public static final Style UNDERLINE
        Underline attribute.
    • Method Detail

      • foreground

        public Color foreground()
        Returns:
        the foreground color
      • background

        public Color background()
        Returns:
        the background color
      • isBold

        public boolean isBold()
        Returns:
        true when the bold attribute is set
      • isReverse

        public boolean isReverse()
        Returns:
        true when the reverse attribute is set
      • isDim

        public boolean isDim()
        Returns:
        true when the dim attribute is set
      • isUnderline

        public boolean isUnderline()
        Returns:
        true when the underline attribute is set
      • fg

        public Style fg​(Color c)
        Sets the foreground color.
        Parameters:
        c - the foreground color
        Returns:
        a new style with the foreground changed
      • bg

        public Style bg​(Color c)
        Sets the background color.
        Parameters:
        c - the background color
        Returns:
        a new style with the background changed
      • bold

        public Style bold​(boolean b)
        Sets the bold attribute.
        Parameters:
        b - whether bold is enabled
        Returns:
        a new style with the bold attribute changed
      • reverse

        public Style reverse​(boolean b)
        Sets the reverse attribute.
        Parameters:
        b - whether reverse is enabled
        Returns:
        a new style with the reverse attribute changed
      • dim

        public Style dim​(boolean b)
        Sets the dim attribute.
        Parameters:
        b - whether dim is enabled
        Returns:
        a new style with the dim attribute changed
      • underline

        public Style underline​(boolean b)
        Sets the underline attribute.
        Parameters:
        b - whether underline is enabled
        Returns:
        a new style with the underline attribute changed
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object