Text is accumulated via append and appendAndReset.
Use append when you want styles to carry over into subsequent segments,
and appendAndReset when each segment should be visually isolated.
Clique.styleBuilder()
.appendAndReset("Success: ", ColorCode.GREEN, StyleCode.BOLD)
.appendAndReset("Operation completed", ColorCode.WHITE)
.print();
| Modifier and Type | Field and Description |
|---|---|
| private static final AnsiCode | |
| private final StringBuilder |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public StyleBuilder | |
| public StyleBuilder | Returns: An instance of thisThe text we're applying the ansiCode to text, AnsiCode... The ANSI code we're applying to the text ansiCodes)Appends an ANSI code to this text and then resets the terminal |
| public boolean | equals(Object object)
Overrides java. Indicates whether some other object is "equal to" this one. |
| public int | |
| public void | print(PrintStream
the stream to print to stream)Prints the accumulated styled string to the given stream. |
| public void | |
| public String | Returns: the styled stringOverrides java. Returns the accumulated styled string. |
| RESET | back to summary |
|---|---|
| private static final AnsiCode RESET | |
| textBuilder | back to summary |
|---|---|
| private final StringBuilder textBuilder | |
| StyleBuilder | back to summary |
|---|---|
| public StyleBuilder() | |
| append | back to summary |
|---|---|
| public StyleBuilder append(String text, AnsiCode... ansiCodes) Appends styled text to this builder without resetting the terminal. Styles accumulate across subsequent calls.
| |
| appendAndReset | back to summary |
|---|---|
| public StyleBuilder appendAndReset(String text, AnsiCode... ansiCodes) Appends an ANSI code to this text and then resets the terminal
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object object) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| back to summary | |
|---|---|
| public void print(PrintStream stream) Prints the accumulated styled string to the given stream.
| |
| back to summary | |
|---|---|
| public void print() Prints the accumulated styled string to | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns the accumulated styled string.
| |