JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q53190F
  • License ISC

A simple package that includes all constants for console text decoration.

Package Exports

  • consolecute
  • consolecute/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (consolecute) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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});

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