colors: {
    default: any;
    BackgroundColor: BackgroundColor;
    Color: Color;
    ForegroundColor: ForegroundColor;
    Instance: Instance;
    Level: Level;
    Modifiers: Modifiers;
    bgBlack: Chalk;
    bgBlackBright: Chalk;
    bgBlue: Chalk;
    bgBlueBright: Chalk;
    bgCyan: Chalk;
    bgCyanBright: Chalk;
    bgGray: Chalk;
    bgGreen: Chalk;
    bgGreenBright: Chalk;
    bgGrey: Chalk;
    bgMagenta: Chalk;
    bgMagentaBright: Chalk;
    bgRed: Chalk;
    bgRedBright: Chalk;
    bgWhite: Chalk;
    bgWhiteBright: Chalk;
    bgYellow: Chalk;
    bgYellowBright: Chalk;
    black: Chalk;
    blackBright: Chalk;
    blue: Chalk;
    blueBright: Chalk;
    bold: Chalk;
    cyan: Chalk;
    cyanBright: Chalk;
    dim: Chalk;
    gray: Chalk;
    green: Chalk;
    greenBright: Chalk;
    grey: Chalk;
    hidden: Chalk;
    inverse: Chalk;
    italic: Chalk;
    level: Level;
    magenta: Chalk;
    magentaBright: Chalk;
    red: Chalk;
    redBright: Chalk;
    reset: Chalk;
    stderr: Chalk & {
        supportsColor: false | ColorSupport;
    };
    strikethrough: Chalk;
    supportsColor: false | ColorSupport;
    underline: Chalk;
    visible: Chalk;
    white: Chalk;
    whiteBright: Chalk;
    yellow: Chalk;
    yellowBright: Chalk;
    ansi(code) => Chalk;
    ansi256(index) => Chalk;
    bgAnsi(code) => Chalk;
    bgAnsi256(index) => Chalk;
    bgHex(color) => Chalk;
    bgHsl(hue, saturation, lightness) => Chalk;
    bgHsv(hue, saturation, value) => Chalk;
    bgHwb(hue, whiteness, blackness) => Chalk;
    bgKeyword(color) => Chalk;
    bgRgb(red, green, blue) => Chalk;
    hex(color) => Chalk;
    hsl(hue, saturation, lightness) => Chalk;
    hsv(hue, saturation, value) => Chalk;
    hwb(hue, whiteness, blackness) => Chalk;
    keyword(color) => Chalk;
    rgb(red, green, blue) => Chalk;
}

Main Chalk object that allows to chain styles together. Call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that chalk.red.yellow.green is equivalent to chalk.green.

Type declaration

  • BackgroundColor: BackgroundColor
  • Color: Color
  • ForegroundColor: ForegroundColor
  • Instance: Instance

    Return a new Chalk instance.

  • Level: Level
  • Modifiers: Modifiers
  • Readonly bgBlack: Chalk
  • Readonly bgBlackBright: Chalk
  • Readonly bgBlue: Chalk
  • Readonly bgBlueBright: Chalk
  • Readonly bgCyan: Chalk
  • Readonly bgCyanBright: Chalk
  • Readonly bgGray: Chalk
  • Readonly bgGreen: Chalk
  • Readonly bgGreenBright: Chalk
  • Readonly bgGrey: Chalk
  • Readonly bgMagenta: Chalk
  • Readonly bgMagentaBright: Chalk
  • Readonly bgRed: Chalk
  • Readonly bgRedBright: Chalk
  • Readonly bgWhite: Chalk
  • Readonly bgWhiteBright: Chalk
  • Readonly bgYellow: Chalk
  • Readonly bgYellowBright: Chalk
  • Readonly black: Chalk
  • Readonly blackBright: Chalk
  • Readonly blue: Chalk
  • Readonly blueBright: Chalk
  • Readonly bold: Chalk

    Modifier: Make text bold.

  • Readonly cyan: Chalk
  • Readonly cyanBright: Chalk
  • Readonly dim: Chalk

    Modifier: Emitting only a small amount of light.

  • Readonly gray: Chalk
  • Readonly green: Chalk
  • Readonly greenBright: Chalk
  • Readonly grey: Chalk
  • Readonly hidden: Chalk

    Modifier: Prints the text, but makes it invisible.

  • Readonly inverse: Chalk

    Modifier: Inverse background and foreground colors.

  • Readonly italic: Chalk

    Modifier: Make text italic. (Not widely supported)

  • level: Level

    The color support for Chalk.

    By default, color support is automatically detected based on the environment.

    Levels:

    • 0 - All colors disabled.
    • 1 - Basic 16 colors support.
    • 2 - ANSI 256 colors support.
    • 3 - Truecolor 16 million colors support.
  • Readonly magenta: Chalk
  • Readonly magentaBright: Chalk
  • Readonly red: Chalk
  • Readonly redBright: Chalk
  • Readonly reset: Chalk

    Modifier: Resets the current color chain.

  • stderr: Chalk & {
        supportsColor: false | ColorSupport;
    }
  • Readonly strikethrough: Chalk

    Modifier: Puts a horizontal line through the center of the text. (Not widely supported)

  • supportsColor: false | ColorSupport
  • Readonly underline: Chalk

    Modifier: Make text underline. (Not widely supported)

  • Readonly visible: Chalk

    Modifier: Prints the text only when Chalk has a color support level > 0. Can be useful for things that are purely cosmetic.

  • Readonly white: Chalk
  • Readonly whiteBright: Chalk
  • Readonly yellow: Chalk
  • Readonly yellowBright: Chalk
  • ansi:function
    • Use a Select/Set Graphic Rendition (SGR) color code number to set text color.

      30 <= code && code < 38 || 90 <= code && code < 98 For example, 31 for red, 91 for redBright.

      Parameters

      • code: number

      Returns Chalk

  • ansi256:function
    • Use a 8-bit unsigned number to set text color.

      Parameters

      • index: number

      Returns Chalk

  • bgAnsi:function
    • Use a Select/Set Graphic Rendition (SGR) color code number to set background color.

      30 <= code && code < 38 || 90 <= code && code < 98 For example, 31 for red, 91 for redBright. Use the foreground code, not the background code (for example, not 41, nor 101).

      Parameters

      • code: number

      Returns Chalk

  • bgAnsi256:function
    • Use a 8-bit unsigned number to set background color.

      Parameters

      • index: number

      Returns Chalk

  • bgHex:function
    • Use HEX value to set background color.

      Parameters

      • color: string

        Hexadecimal value representing the desired color.

      Returns Chalk

      Example

      import chalk = require('chalk');

      chalk.bgHex('#DEADED');
  • bgHsl:function
    • Use HSL values to set background color.

      Parameters

      • hue: number
      • saturation: number
      • lightness: number

      Returns Chalk

  • bgHsv:function
    • Use HSV values to set background color.

      Parameters

      • hue: number
      • saturation: number
      • value: number

      Returns Chalk

  • bgHwb:function
    • Use HWB values to set background color.

      Parameters

      • hue: number
      • whiteness: number
      • blackness: number

      Returns Chalk

  • bgKeyword:function
    • Use keyword color value to set background color.

      Parameters

      • color: string

        Keyword value representing the desired color.

      Returns Chalk

      Example

      import chalk = require('chalk');

      chalk.bgKeyword('orange');
  • bgRgb:function
    • Use RGB values to set background color.

      Parameters

      • red: number
      • green: number
      • blue: number

      Returns Chalk

  • hex:function
    • Use HEX value to set text color.

      Parameters

      • color: string

        Hexadecimal value representing the desired color.

      Returns Chalk

      Example

      import chalk = require('chalk');

      chalk.hex('#DEADED');
  • hsl:function
    • Use HSL values to set text color.

      Parameters

      • hue: number
      • saturation: number
      • lightness: number

      Returns Chalk

  • hsv:function
    • Use HSV values to set text color.

      Parameters

      • hue: number
      • saturation: number
      • value: number

      Returns Chalk

  • hwb:function
    • Use HWB values to set text color.

      Parameters

      • hue: number
      • whiteness: number
      • blackness: number

      Returns Chalk

  • keyword:function
    • Use keyword color value to set text color.

      Parameters

      • color: string

        Keyword value representing the desired color.

      Returns Chalk

      Example

      import chalk = require('chalk');

      chalk.keyword('orange');
  • rgb:function
    • Use RGB values to set text color.

      Parameters

      • red: number
      • green: number
      • blue: number

      Returns Chalk

Generated using TypeDoc