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

    Return a new Chalk instance.

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

    Modifier: Make text bold.

  • Readonly cyan: Core.colors.Chalk
  • Readonly cyanBright: Core.colors.Chalk
  • Readonly dim: Core.colors.Chalk

    Modifier: Emitting only a small amount of light.

  • Readonly gray: Core.colors.Chalk
  • Readonly green: Core.colors.Chalk
  • Readonly greenBright: Core.colors.Chalk
  • Readonly grey: Core.colors.Chalk
  • Readonly hidden: Core.colors.Chalk

    Modifier: Prints the text, but makes it invisible.

  • Readonly inverse: Core.colors.Chalk

    Modifier: Inverse background and foreground colors.

  • Readonly italic: Core.colors.Chalk

    Modifier: Make text italic. (Not widely supported)

  • level: Core.colors.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: Core.colors.Chalk
  • Readonly magentaBright: Core.colors.Chalk
  • Readonly red: Core.colors.Chalk
  • Readonly redBright: Core.colors.Chalk
  • Readonly reset: Core.colors.Chalk

    Modifier: Resets the current color chain.

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

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

  • supportsColor: false | Core.colors.ColorSupport
  • Readonly underline: Core.colors.Chalk

    Modifier: Make text underline. (Not widely supported)

  • Readonly visible: Core.colors.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: Core.colors.Chalk
  • Readonly whiteBright: Core.colors.Chalk
  • Readonly yellow: Core.colors.Chalk
  • Readonly yellowBright: Core.colors.Chalk
  • ansi:function
  • ansi256:function
  • 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 Core.colors.Chalk

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

      Parameters

      • color: string

        Hexadecimal value representing the desired color.

      Returns Core.colors.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 Core.colors.Chalk

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

      Parameters

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

      Returns Core.colors.Chalk

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

      Parameters

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

      Returns Core.colors.Chalk

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

      Parameters

      • color: string

        Keyword value representing the desired color.

      Returns Core.colors.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 Core.colors.Chalk

  • default:function
    • Use a template string.

      Parameters

      • text: TemplateStringsArray
      • Rest ...placeholders: unknown[]

      Returns string

      Remarks

      Template literals are unsupported for nested calls (see issue #341)

      Example

      import chalk = require('chalk');

      log(chalk`
      CPU: {red ${cpu.totalPercent}%}
      RAM: {green ${ram.used / ram.total * 100}%}
      DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
      `);

      Example

      import chalk = require('chalk');

      log(chalk.red.bgBlack`2 + 3 = {bold ${2 + 3}}`)
    • Parameters

      • Rest ...text: unknown[]

      Returns string

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

      Parameters

      • color: string

        Hexadecimal value representing the desired color.

      Returns Core.colors.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 Core.colors.Chalk

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

      Parameters

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

      Returns Core.colors.Chalk

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

      Parameters

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

      Returns Core.colors.Chalk

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

      Parameters

      • color: string

        Keyword value representing the desired color.

      Returns Core.colors.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 Core.colors.Chalk

Generated using TypeDoc