1.0.2 • Published 6 months ago
litecolor v1.0.2
LiteColor
An ultra-tiny, elegant, and agnostic library for console styling, written in TypeScript.
import { style } from "litecolor";
const text = style("Hello world!")
.color("green")
.bold()
.toString();
console.log(text);
See more examples in the examples folder.
✨ Features
🎀 Styles and colors
A clarification: the .toString()
method is required to convert a string after applying colors and styles.
Colors are applied with the .color()
method.
const text = style("hello world").color("red").toString(); // 'red' color
And they are the following:
# Colors:
black
red
green
yellow
blue
magenta
cyan
white
gray
grey
# More vivid colors:
brightBlack
brightRed
brightGreen
brightYellow
brightBlue
brightMagenta
brightCyan
brightWhite
brightGray
brightGrey
Each style has its own method.
const text = style("hello world").bold().toString(); // 'bold' style
And they are the following:
# Styles:
reset
bold
dim
italic
underline
inverse
hidden
strikethrough
Background colors are applied with the .bg()
method.
const text = style("hello world").bg("green").toString(); // 'green' background color
📄 License
This project is licensed under the MIT License.