String

public extension String
  • Adds the ANSII codes for the specified color to the beginning of the string and the reset code at the end to avoid coloring of the next output string in some terminals

    Declaration

    Swift

    func addingTerminalColor(_ color: Terminal.TextColor) -> String

    Parameters

    color

    The ANSII color that should be used to format the string

    Return Value

    A new String instance formatted to render in the specified color in terminals

  • Adds the ANSII codes for the specified backgroundcolor to the beginning of the string and the reset code at the end to avoid coloring of the next output string in some terminals

    Declaration

    Swift

    func addingTerminalBackgroundColor(_ color: Terminal.BackgroundColor) -> String

    Parameters

    color

    The ANSII backgroundcolor that should be used to format the string

    Return Value

    A new String instance formatted to render with the specified background color in terminals

  • Adds the ANSII codes for the specified text decoration to the beginning of the string and the reset code at the end to avoid coloring of the next output string in some terminals

    Declaration

    Swift

    func addingTerminalTextDecoration(_ decoration: Terminal.TextDecoration) -> String

    Parameters

    decoration

    The ANSII text decoration that should be used to format the string

    Return Value

    A new String instance formatted to render with the specified text decoration in terminals

  • Adds the ANSII codes for the specified text color, background and decoration and a reset code at the end

    Declaration

    Swift

    func addingTerminalStyling(
        color: Terminal.TextColor? = nil,
        backgroundColor: Terminal.BackgroundColor? = nil,
        decoration: Terminal.TextDecoration? = nil) -> String

    Parameters

    color

    The ANSII color that should be used to format the string

    backgroundColor

    The ANSII backgroundcolor that should be used to format the string

    decoration

    The ANSII text decoration that should be used to format the string

    Return Value

    A new String instance formatted to render with the specified text color, background and decoration in terminals