0.0.5 • Published 10 months ago

clcolorize v0.0.5

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

clcolorize

Simple library for command line coloring.

Install

npm i clcolorize

API

  • clcolorize - Provides a collection of color methods and a function to enable or disable colors.
  • clc - A utility to apply multiple color styles to a string.

Usage

clcolorize

clcolorize: Colors & { createColors: (enabled?: boolean) => Colors }

The clcolorize object contains various methods for coloring strings, based on the Colors interface. You can also create a custom instance with the createColors method, enabling or disabling coloring as needed.

import { clcolorize } from 'clcolorize';

const { red, bold } = clcolorize;

console.log(red('This text will be red!'));
console.log(bold('This text will be bold!'));

// Disable colors
const noColors = clcolorize.createColors(false);
console.log(noColors.red('This will not be colored!'));

clc

clc(string: string, style: (keyof Omit<Colors, 'isColorSupported'>)[]): string

The clc function allows you to apply multiple color styles to a string in one go. You can pass an array of styles from the Colors interface to format the string.

import { clc } from 'clcolorize';

const styledText = clc('This will be red and bold', ['red', 'bold']);
console.log(styledText);
0.0.5

10 months ago

0.0.4

10 months ago

0.0.3

10 months ago

0.0.2

10 months ago

0.0.1

10 months ago