eightBit
The eightBit() function creates an 8-bit color value that can be passed to the color or backgroundColor properties of StyleOptions. It accepts a code number from 0 to 255.
Signature
function eightBit(code: number): EightBitColorValue
Parameters
code: A number from 0 to 255 (clamped and truncated automatically). Can use theEightBitColorenum for named values.
Return Value
Returns an EightBitColorValue object: { __type: "8bit", code: number }
Usage
import { s, eightBit, EightBitColor } from "ts-better-console";
// Raw code number
console.log(s("Orange", { color: eightBit(208) }));
// With EightBitColor enum
console.log(s("Pink", { color: eightBit(EightBitColor.Pink) }));
// As background
console.log(s("bg", { backgroundColor: eightBit(123) }));
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!