@nightgrey/ansi
    Preparing search index...

    Class Attributes

    Attributes

    A performant bitset representation to handle SGR attributes.

    const attributes = new Attributes()
    .foregroundColor(BasicColor.Red)
    .underline()
    .bold()
    .italic();

    attributes.has(1 << Bit.Bold); // true
    attributes.has(1 << Bit.Italic); // true
    attributes.has(1 << Bit.Underline); // true
    attributes.has(1 << Bit.ForegroundColor); // true


    attributes.and(new Attributes().backgroundColor(BasicColor.Blue));
    attributes.or(new Attributes().backgroundColor(BasicColor.Blue));
    attributes.xor(new Attributes().backgroundColor(BasicColor.Blue));

    new Style(attributes);

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    "[toStringTag]": string = "Attributable"
    bg: null | number

    Background color

    Either an ANSI indexed color (0-255) or a packed RGB.

    0
    
    (255 << 8) | (255 << 16) | (255 << 24)
    
    fg: null | number

    Foreground color

    Either an ANSI indexed color (0-255) or a packed RGB.

    1
    
    (255 << 8) | (255 << 16) | (255 << 24)
    
    ul: null | number

    Underline color

    Either an ANSI indexed color (0-255) or a packed RGB.

    2
    
    (255 << 8) | (255 << 16) | (255 << 24)
    
    value: number

    Attributes

    A bitset representening the set attributes.

    Accessors

    Methods

    • Return a new Attributable instance with the given parameters.

      Parameters

      • Optionalattributes: number

        Next value of the attributable

      • Optionalbackground: null | number

        Next background color

      • Optionalforeground: null | number

        Next foreground color

      • Optionalunderline: null | number

        Next underline color

      Returns Attributes

      function with(
      attributes?: number,
      background?: ColorAttribute | null,
      foreground?: ColorAttribute | null,
      underline?: ColorAttribute | null,
      ) {
      return new Attributes(
      attributes ?? this.value,
      background === null ? null : background || this.bg,
      foreground === null ? null : foreground || this.fg,
      underline === null ? null : underline || this.ul,
      );
      }