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).


    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"


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

    Type Parameters

    • Open extends number


    • 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