• Version 4.1.1
  • Published
  • 24.4 kB
  • No dependencies
  • MIT license


npm i ansi-colors
yarn add ansi-colors
pnpm add ansi-colors


Easily add ANSI colors to your text and symbols in the terminal. A faster drop-in replacement for chalk, kleur and turbocolor (without the dependencies and rendering bugs).



variable ansiRegex

const ansiRegex: RegExp;

    variable bgBlack

    const bgBlack: StyleFunction;

      variable bgBlackBright

      const bgBlackBright: StyleFunction;

        variable bgBlue

        const bgBlue: StyleFunction;

          variable bgBlueBright

          const bgBlueBright: StyleFunction;

            variable bgCyan

            const bgCyan: StyleFunction;

              variable bgCyanBright

              const bgCyanBright: StyleFunction;

                variable bgGreen

                const bgGreen: StyleFunction;

                  variable bgGreenBright

                  const bgGreenBright: StyleFunction;

                    variable bgMagenta

                    const bgMagenta: StyleFunction;

                      variable bgMagentaBright

                      const bgMagentaBright: StyleFunction;

                        variable bgRed

                        const bgRed: StyleFunction;

                          variable bgRedBright

                          const bgRedBright: StyleFunction;

                            variable bgWhite

                            const bgWhite: StyleFunction;

                              variable bgWhiteBright

                              const bgWhiteBright: StyleFunction;

                                variable bgYellow

                                const bgYellow: StyleFunction;

                                  variable bgYellowBright

                                  const bgYellowBright: StyleFunction;

                                    variable black

                                    const black: StyleFunction;

                                      variable blackBright

                                      const blackBright: StyleFunction;

                                        variable blue

                                        const blue: StyleFunction;

                                          variable blueBright

                                          const blueBright: StyleFunction;

                                            variable bold

                                            const bold: StyleFunction;

                                              variable cyan

                                              const cyan: StyleFunction;

                                                variable cyanBright

                                                const cyanBright: StyleFunction;

                                                  variable dim

                                                  const dim: StyleFunction;

                                                    variable enabled

                                                    let enabled: boolean;

                                                      variable gray

                                                      const gray: StyleFunction;

                                                        variable green

                                                        const green: StyleFunction;

                                                          variable greenBright

                                                          const greenBright: StyleFunction;

                                                            variable grey

                                                            const grey: StyleFunction;

                                                              variable hidden

                                                              const hidden: StyleFunction;

                                                                variable inverse

                                                                const inverse: StyleFunction;

                                                                  variable italic

                                                                  const italic: StyleFunction;

                                                                    variable magenta

                                                                    const magenta: StyleFunction;

                                                                      variable magentaBright

                                                                      const magentaBright: StyleFunction;

                                                                        variable red

                                                                        const red: StyleFunction;

                                                                          variable redBright

                                                                          const redBright: StyleFunction;

                                                                            variable reset

                                                                            const reset: StyleFunction;

                                                                              variable strikethrough

                                                                              const strikethrough: StyleFunction;

                                                                                variable styles

                                                                                const styles: StylesType<StyleType>;

                                                                                  variable symbols

                                                                                  const symbols: SymbolsType;

                                                                                    variable underline

                                                                                    const underline: StyleFunction;

                                                                                      variable visible

                                                                                      let visible: boolean;

                                                                                        variable white

                                                                                        const white: StyleFunction;

                                                                                          variable whiteBright

                                                                                          const whiteBright: StyleFunction;

                                                                                            variable yellow

                                                                                            const yellow: StyleFunction;

                                                                                              variable yellowBright

                                                                                              const yellowBright: StyleFunction;


                                                                                                function ok

                                                                                                ok: (...args: string[]) => string;
                                                                                                • Outputs a string with check-symbol as prefix

                                                                                                function strip

                                                                                                strip: (s: string) => string;
                                                                                                • Remove styles from string

                                                                                                function stripColor

                                                                                                stripColor: (s: string) => string;
                                                                                                • Remove styles from string

                                                                                                function unstyle

                                                                                                unstyle: (s: string) => string;
                                                                                                • Remove styles from string


                                                                                                interface StyleArrayProperties

                                                                                                interface StyleArrayProperties {}

                                                                                                  property close

                                                                                                  close: string;

                                                                                                    property closeRe

                                                                                                    closeRe: string;

                                                                                                      property open

                                                                                                      open: string;

                                                                                                        interface StyleFunction

                                                                                                        interface StyleFunction extends StylesType<StyleFunction> {}

                                                                                                          call signature

                                                                                                          (s: string): string;

                                                                                                            interface StylesType

                                                                                                            interface StylesType<T> {}

                                                                                                              property bgBlack

                                                                                                              bgBlack: T;

                                                                                                                property bgBlackBright

                                                                                                                bgBlackBright: T;

                                                                                                                  property bgBlue

                                                                                                                  bgBlue: T;

                                                                                                                    property bgBlueBright

                                                                                                                    bgBlueBright: T;

                                                                                                                      property bgCyan

                                                                                                                      bgCyan: T;

                                                                                                                        property bgCyanBright

                                                                                                                        bgCyanBright: T;

                                                                                                                          property bgGreen

                                                                                                                          bgGreen: T;

                                                                                                                            property bgGreenBright

                                                                                                                            bgGreenBright: T;

                                                                                                                              property bgMagenta

                                                                                                                              bgMagenta: T;

                                                                                                                                property bgMagentaBright

                                                                                                                                bgMagentaBright: T;

                                                                                                                                  property bgRed

                                                                                                                                  bgRed: T;

                                                                                                                                    property bgRedBright

                                                                                                                                    bgRedBright: T;

                                                                                                                                      property bgWhite

                                                                                                                                      bgWhite: T;

                                                                                                                                        property bgWhiteBright

                                                                                                                                        bgWhiteBright: T;

                                                                                                                                          property bgYellow

                                                                                                                                          bgYellow: T;

                                                                                                                                            property bgYellowBright

                                                                                                                                            bgYellowBright: T;

                                                                                                                                              property black

                                                                                                                                              black: T;

                                                                                                                                                property blackBright

                                                                                                                                                blackBright: T;

                                                                                                                                                  property blue

                                                                                                                                                  blue: T;

                                                                                                                                                    property blueBright

                                                                                                                                                    blueBright: T;

                                                                                                                                                      property bold

                                                                                                                                                      bold: T;

                                                                                                                                                        property cyan

                                                                                                                                                        cyan: T;

                                                                                                                                                          property cyanBright

                                                                                                                                                          cyanBright: T;

                                                                                                                                                            property dim

                                                                                                                                                            dim: T;

                                                                                                                                                              property gray

                                                                                                                                                              gray: T;

                                                                                                                                                                property green

                                                                                                                                                                green: T;

                                                                                                                                                                  property greenBright

                                                                                                                                                                  greenBright: T;

                                                                                                                                                                    property grey

                                                                                                                                                                    grey: T;

                                                                                                                                                                      property hidden

                                                                                                                                                                      hidden: T;

                                                                                                                                                                        property inverse

                                                                                                                                                                        inverse: T;

                                                                                                                                                                          property italic

                                                                                                                                                                          italic: T;

                                                                                                                                                                            property magenta

                                                                                                                                                                            magenta: T;

                                                                                                                                                                              property magentaBright

                                                                                                                                                                              magentaBright: T;

                                                                                                                                                                                property red

                                                                                                                                                                                red: T;

                                                                                                                                                                                  property redBright

                                                                                                                                                                                  redBright: T;

                                                                                                                                                                                    property reset

                                                                                                                                                                                    reset: T;

                                                                                                                                                                                      property strikethrough

                                                                                                                                                                                      strikethrough: T;

                                                                                                                                                                                        property underline

                                                                                                                                                                                        underline: T;

                                                                                                                                                                                          property white

                                                                                                                                                                                          white: T;

                                                                                                                                                                                            property whiteBright

                                                                                                                                                                                            whiteBright: T;

                                                                                                                                                                                              property yellow

                                                                                                                                                                                              yellow: T;

                                                                                                                                                                                                property yellowBright

                                                                                                                                                                                                yellowBright: T;

                                                                                                                                                                                                  interface SymbolsType

                                                                                                                                                                                                  interface SymbolsType {}

                                                                                                                                                                                                    property check

                                                                                                                                                                                                    check: string;

                                                                                                                                                                                                      property cross

                                                                                                                                                                                                      cross: string;

                                                                                                                                                                                                        property info

                                                                                                                                                                                                        info: string;

                                                                                                                                                                                                          property line

                                                                                                                                                                                                          line: string;

                                                                                                                                                                                                            property pointer

                                                                                                                                                                                                            pointer: string;

                                                                                                                                                                                                              property pointerSmall

                                                                                                                                                                                                              pointerSmall: string;

                                                                                                                                                                                                                property question

                                                                                                                                                                                                                question: string;

                                                                                                                                                                                                                  property warning

                                                                                                                                                                                                                  warning: string;

                                                                                                                                                                                                                    Type Aliases

                                                                                                                                                                                                                    type StyleArrayStructure

                                                                                                                                                                                                                    type StyleArrayStructure = [number, number];

                                                                                                                                                                                                                      type StyleType

                                                                                                                                                                                                                      type StyleType = StyleArrayStructure & StyleArrayProperties;

                                                                                                                                                                                                                        Package Files (1)

                                                                                                                                                                                                                        Dependencies (0)

                                                                                                                                                                                                                        No dependencies.

                                                                                                                                                                                                                        Dev Dependencies (5)

                                                                                                                                                                                                                        Peer Dependencies (0)

                                                                                                                                                                                                                        No peer dependencies.


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

                                                                                                                                                                                                                        You may also use to create a custom badge linking to

                                                                                                                                                                                                                        • Markdown
                                                                                                                                                                                                                        • HTML
                                                                                                                                                                                                                          <a href=""><img src="" alt=""></a>