Function mix

  • Composes formatters.

    Example

    const redTextWhiteBackground = mix(foregroundRed, backgroundWhite);

    redTextWhiteBackground("Vangware");
    // It can also be used as a tag function for tagged templates:
    redTextWhiteBackground`Vangware`;

    Returns

    Formatter composed of the given formatters.

    Parameters

    • Rest ...formatters: ReadOnlyArray<Formatter>

      Array of formatters to be composed.

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

      • (input: string | Readonly<TemplateStringsArray>, ...expressions: ReadOnlyArray<unknown>): string
      • Function with formatters set in context.

        Example

        redTextWhiteBackground("Vangware");
        // It can also be used as a tag function for tagged templates:
        redTextWhiteBackground`Vangware`;

        Returns

        Formatted string.

        Parameters

        • input: string | Readonly<TemplateStringsArray>

          String or template string.

        • Rest ...expressions: ReadOnlyArray<unknown>

          Possible values passed to the template string.

        Returns string