Package com.tonic.vellum.style
Class Style
- java.lang.Object
-
- com.tonic.vellum.style.Style
-
public final class Style extends java.lang.ObjectAn immutable text styling value; setters return new instances and instances compare by value.
-
-
Field Summary
Fields Modifier and Type Field Description static StyleBOLDBold attribute.static StyleDIMDim attribute.static StyleDIM_REVERSEDimmed inverse.static StyleNORMALDefault foreground and background with no attributes.static StyleREVERSEInverted foreground and background.static StyleUNDERLINEUnderline attribute.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Colorbackground()Stylebg(Color c)Sets the background color.Stylebold(boolean b)Sets the bold attribute.Styledim(boolean b)Sets the dim attribute.booleanequals(java.lang.Object o)Stylefg(Color c)Sets the foreground color.Colorforeground()inthashCode()booleanisBold()booleanisDim()booleanisReverse()booleanisUnderline()Stylereverse(boolean b)Sets the reverse attribute.java.lang.StringtoString()Styleunderline(boolean b)Sets the underline attribute.
-
-
-
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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-