Function foregroundColor

  • Takes an open ANSI code and an input string and adds the open and close ANSI codes to that string (for text color).

    Example

    foregroundColor(13)("Vangware"); // "\x1b[13mVangware\x1b[39m"
    // It can also be used as a tag function for tagged templates:
    foregroundColor(13)`Vangware`; // "\x1b[13mVangware\x1b[39m"

    Returns

    Curried function with close ANSI code for text color in context.

    Type Parameters

    • Open extends number

    Parameters

    • open: Open

    Returns ((input: string | Readonly<TemplateStringsArray>, ...expressions: ReadOnlyArray<unknown>) => string)

      • (input: string | Readonly<TemplateStringsArray>, ...expressions: ReadOnlyArray<unknown>): string
      • Parameters

        • input: string | Readonly<TemplateStringsArray>
        • Rest ...expressions: ReadOnlyArray<unknown>

        Returns string