EightBitColor

The EightBitColor enum provides named constants for commonly used 8-bit (256) color codes. Use it with the eightBit() helper function to easily reference colors by name instead of memorizing code numbers.

Enum Definition

enum EightBitColor {
  // Standard colors (0–7)
  Black = 0,
  Red = 1,
  Green = 2,
  Yellow = 3,
  Blue = 4,
  Magenta = 5,
  Cyan = 6,
  White = 7,

  // High-intensity colors (8–15)
  BrightBlack = 8,
  BrightRed = 9,
  BrightGreen = 10,
  BrightYellow = 11,
  BrightBlue = 12,
  BrightMagenta = 13,
  BrightCyan = 14,
  BrightWhite = 15,

  // Popular extended colors (16–231)
  Orange = 208,
  Pink = 213,
  Purple = 129,
  Teal = 30,
  Gold = 220,
  // ... and more
}

Usage

import { s, eightBit, EightBitColor } from "ts-better-console";

console.log(s("Orange text", { color: eightBit(EightBitColor.Orange) }));
console.log(s("Navy bg", { backgroundColor: eightBit(EightBitColor.Navy) }));

Want to support this project?

If you find ts-better-console useful and want to support its development, consider starring the GitHub repository or buying me a coffee! Your support helps me dedicate more time to improving the library and adding new features.

Want to contribute to this project?

Contributions are welcome! If you're interested in improving the library, fixing bugs, or adding new features, feel free to check out the GitHub repository and submit a pull request. Whether you're a seasoned developer or new to open source, your contributions can make a difference!