1.0.2 • Published 6 months ago

litecolor v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

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

  • Ultra tiny (0.9kb) Minzipped size
  • Elegant API
  • Agnostic (Deno, Bun and NodeJS)
  • Variety of styles and colors

🎀 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.


1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago