consolecute
v1.0.7
Published
A simple package that includes all constants for console text decoration.
Downloads
4
Maintainers
Readme
Console Cute
This is primarily a list of values that can be used to print prettier text to your console. It includes color constants like RED
, GREEN
and YELLOW
and background color constants like BG_BLUE
, BG_CYAN
, and BG_WHITE
. It also contains other text decoration constants for your console like ITALIC
, BOLD
and UNDERLINE
. It has three functions, an RGB
and BG_RGB
function that creates strings for specific RGB values and a PRINT
function that trims and allows you to apply styles to text you are printing to the console.
Usage
You can use the colors directly with a console.log function by appending the string values like this:
import {RED, BLUE, BG_WHITE, RESET } from 'consolecute';
console.log(`${RED}This will print RED text.${RESET}`);
console.log(`${BLUE}${BG_WHITE}Blue text on a white background.${RESET});
PRINT function
The PRINT
function makes it fairly simple to color text and automatically reset it.
import { PRINT, RED, RESET } from 'consolecute';
PRINT('This will print in RED', RED);
It will also remove all the leading space from multi-line text for when you log from a function.
if( true ) {
PRINT(`
================================================
The leading space on the left will be removed.
================================================
`);
}
Options
Here are a list of the colors and other options you can import:
Text color strings:
BLACK
RED
GREEN
YELLOW
BLUE
MAGENTA
CYAN
WHITE
RGB(r, g, b)
DEFAULT
Background color strings:
BG_BLACK
BG_RED
BG_GREEN
BG_YELLOW
BG_BLUE
BG_MAGENTA
BG_CYAN
BG_WHITE
BG_RGB(r, g, b)
BG_DEFAULT
Control strings:
RESET
BOLD
DIM
ITALIC
UNDERLINE
BLINK
REVERSE
HIDDEN
STRIKETHROUGH
DBL_UNDERLINE
DBL_BLINK
From Rick
This library is pretty simple. I just wanted a list of all the controls strings exported in an index.js file for working on CardTable.com. If you need some help, I'm on Twitter/X @battagline