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
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA buffer associated with aCliPrinterused to build up a string of colored text. -
Method Summary
Modifier and TypeMethodDescriptiondefault ColorFormatter.PrinterBufferprinterBuffer(CliPrinter printer) Creates aColorFormatter.PrinterBufferused to build up a long string of styled text.default voidprintln(CliPrinter printer, String text, Style... styles) Print a styled line of text to the givenprinter.voidstyle(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.PrinterBufferused 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.
-