JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q32337F
  • License MIT

A lightweight package for coloring text using ANSI codes, perfect for adding visual style to terminal outputs.

Package Exports

  • strcolorize
  • strcolorize/dist/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 (strcolorize) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

๐Ÿงถ strcolorize

strcolorize is a simple library for coloring text using codes (ANSI and hexadecimal), perfect for styling your terminal strings. strcolorize uses inline formatting (applies text formatting styles directly within the text line) to colorize your texts.


NPM Version NPM Downloads NPM License
Styles


๐Ÿ“ฆ Install

npm install strcolorize
yarn install strcolorize

๐Ÿฟ Highlights

  • No dependencies
  • Ability to nest styles
  • Doesn't extend String.prototype
  • Clean and focused
  • Support for Hexadecimal codes (text colors)

๐ŸŽˆ How To Usage?

colorize(input: string, terminal: boolean [Opcional]):

  • input: The text to be styled.
  • terminal: Print directly to the terminal [default is false].
const colorize = require('strcolorize'); // module commonjs
import colorize from 'strcolorize'; // module esm

// Coloring with ANSI codes.
colorize('This word is [red](red)', true)

// Coloring with hexadecimal codes.
colorize('This especif word is [blue](#0000FF)', true)

// Nesting colorizations.
colorize('[Welcome to [strcolorize](magenta) library](bold)', true)

Terminal output:

Styles

๐ŸŽจ Colors and Styles

Text styles:

  • reset: Reset the current style.
  • bold: Make the text bold.
  • italic: Make the text italic.
  • inverse: Invert background and foreground colors.
  • underline: Put a horizontal line below the text.
  • hidden: Print the text but make it invisible.
  • strikethrough: Puts a horizontal line through the center of the text.

Text colors:

  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • white
  • gray

Text backgrounds:

  • bgBlack
  • bgRed
  • bgGreen
  • bgYellow
  • bgBlue
  • bgCyan
  • bgWhite

๐Ÿ’– Contribuition

Your contributions are highly valued! Feel free to enhance this project by opening an issue to report any problems or submitting a pull request with your proposed changes.