Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ansi-colors

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ansi-colors

Collection of ansi colors and styles.

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is ansi-colors?

The ansi-colors npm package is a utility for styling strings in the terminal with ANSI escape codes. It allows developers to add color and style to text output in command-line applications.

What are ansi-colors's main functionalities?

Text Colors

Apply text color to strings. The example shows how to make text red.

"const colors = require('ansi-colors');\nconsole.log(colors.red('This is red text'));"

Background Colors

Apply background color to strings. The example shows how to give text a red background.

"const colors = require('ansi-colors');\nconsole.log(colors.bgRed('This has a red background'));"

Text Styles

Apply text styles like bold, italic, underline, etc. The example shows how to make text bold.

"const colors = require('ansi-colors');\nconsole.log(colors.bold('This is bold text'));"

Chaining Styles

Chain multiple styles together. The example shows text that is blue, bold, and underlined.

"const colors = require('ansi-colors');\nconsole.log(colors.blue.bold.underline('This is blue, bold, and underlined'));"

Custom Themes

Create custom themes by combining styles. The example defines a custom theme with styles for error and warning messages.

"const colors = require('ansi-colors');\nconst customTheme = {\n  error: colors.red.bold,\n  warning: colors.yellow.italic\n};\nconsole.log(customTheme.error('Error message'));\nconsole.log(customTheme.warning('Warning message'));"

Other packages similar to ansi-colors

Keywords

FAQs

Package last updated on 30 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc