ansi-fragments

  • Version 0.2.1
  • Published
  • 30 kB
  • 3 dependencies
  • MIT license

Install

npm i ansi-fragments
yarn add ansi-fragments
pnpm add ansi-fragments

Overview

A tiny library with builders to help making logs/CLI pretty with a nice DX.

Index

Functions

function color

color: (ansiColor: AnsiColor, ...children: Array<string | IFragment>) => Color;

    function container

    container: (...children: Array<string | IFragment>) => Container;

      function fixed

      fixed: (
      value: number,
      bias: Bias,
      ...children: Array<string | IFragment>
      ) => Fixed;

        function ifElse

        ifElse: (
        condition: Condition,
        ifTrueFragment: string | IFragment,
        elseFragment?: string | IFragment
        ) => IfElse;

          function modifier

          modifier: (
          ansiModifier: AnsiModifier,
          ...children: Array<string | IFragment>
          ) => Modifier;

            function pad

            pad: (count: number, separator?: string) => Pad;

              Type Aliases

              type AnsiColor

              type AnsiColor =
              | 'black'
              | 'red'
              | 'green'
              | 'yellow'
              | 'blue'
              | 'magenta'
              | 'cyan'
              | 'white'
              | 'brightBlack'
              | 'brightRed'
              | 'brightGreen'
              | 'brightYellow'
              | 'brightBlue'
              | 'brightMagenta'
              | 'brightCyan'
              | 'brightWhite'
              | 'gray'
              | 'bgBlack'
              | 'bgRed'
              | 'bgGreen'
              | 'bgYellow'
              | 'bgBlue'
              | 'bgMagenta'
              | 'bgCyan'
              | 'bgWhite'
              | 'bgBrightBlack'
              | 'bgBrightRed'
              | 'bgBrightGreen'
              | 'bgBrightYellow'
              | 'bgBrightBlue'
              | 'bgBrightMagenta'
              | 'bgBrightCyan'
              | 'bgBrightWhite'
              | 'none';

                type AnsiModifier

                type AnsiModifier =
                | 'dim'
                | 'bold'
                | 'hidden'
                | 'italic'
                | 'underline'
                | 'strikethrough'
                | 'none';

                  type Condition

                  type Condition = ConditionValue | (() => ConditionValue);

                    type ConditionValue

                    type ConditionValue = boolean | string | number | null | undefined;

                      Package Files (7)

                      Dependencies (3)

                      Dev Dependencies (9)

                      Peer Dependencies (0)

                      No peer dependencies.

                      Badge

                      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/ansi-fragments.

                      • Markdown
                        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/ansi-fragments)
                      • HTML
                        <a href="https://www.jsdocs.io/package/ansi-fragments"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>