BackgroundColors
The BackgroundColors enum provides ANSI escape codes for setting text background colors in terminal output. These values are used internally by ts-better-console to apply background color styling via the s function and StyleOptions.
Enum Definition
The BackgroundColors enum maps color names to their corresponding ANSI background escape sequences:
enum BackgroundColors {
black = "\x1b[40m",
red = "\x1b[41m",
green = "\x1b[42m",
yellow = "\x1b[43m",
blue = "\x1b[44m",
magenta = "\x1b[45m",
cyan = "\x1b[46m",
white = "\x1b[47m",
gray = "\x1b[100m",
}
Available Background Colors
blackredgreenyellowbluemagentacyanwhitegrayUsage
While the BackgroundColors enum is used internally, you typically set background colors via the StyleOptions type when using the s function. You can also import and use the enum directly for advanced use cases:
import { s } from "ts-better-console";
// Using backgroundColor via StyleOptions
console.log(s("Highlighted!", {color: "white",backgroundColor: "red",}));
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!