Package software.amazon.smithy.cli
Interface ColorFormatter
- All Known Implementing Classes:
AnsiColorFormatter
public interface ColorFormatter
Styles text using color codes.
- See Also:
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final class
A buffer associated with aCliPrinter
used to build up a string of colored text. -
Method Summary
Modifier and TypeMethodDescriptiondefault ColorFormatter.PrinterBuffer
printerBuffer
(CliPrinter printer) Creates aColorFormatter.PrinterBuffer
used to build up a long string of styled text.default void
println
(CliPrinter printer, String text, Style... styles) Print a styled line of text to the givenprinter
.void
style
(Appendable appendable, String text, Style... styles) Styles text using the given styles and writes it to an Appendable.Styles text using the given styles.
-
Method Details
-
style
Styles text using the given styles.- Parameters:
text
- Text to style.styles
- Styles to apply.- Returns:
- Returns the styled text.
-
style
Styles text using the given styles and writes it to an Appendable.- Parameters:
appendable
- Where to write styled text.text
- Text to write.styles
- Styles to apply.
-
println
Print a styled line of text to the givenprinter
.- Parameters:
printer
- Printer to write to.text
- Text to write.styles
- Styles to apply.
-
printerBuffer
Creates aColorFormatter.PrinterBuffer
used to build up a long string of styled text.Call
ColorFormatter.PrinterBuffer.close()
or use try-with-resources to write to the printer.- Returns:
- Returns the buffer.
-