Socket
Socket
Sign inDemoInstall

charm

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

charm

ansi control sequences for terminal cursor hopping and colors


Version published
Weekly downloads
1.7M
increased by7.93%
Maintainers
1
Weekly downloads
 
Created

What is charm?

The 'charm' npm package is a library for manipulating terminal output, allowing you to create dynamic and interactive text-based user interfaces. It provides functionalities for cursor movement, text styling, and screen manipulation.

What are charm's main functionalities?

Cursor Movement

This feature allows you to move the cursor to specific positions on the terminal screen. The code sample demonstrates how to position the cursor at (0, 0) and (10, 10) and write text at those positions.

const charm = require('charm')();
charm.pipe(process.stdout);
charm.position(0, 0);
charm.write('Hello, World!');
charm.position(10, 10);
charm.write('Moved to (10, 10)');

Text Styling

This feature allows you to style text with different colors and attributes. The code sample shows how to change the text color to red and the background color to blue.

const charm = require('charm')();
charm.pipe(process.stdout);
charm.foreground('red');
charm.write('This is red text');
charm.display('reset');
charm.background('blue');
charm.write('This is text with a blue background');
charm.display('reset');

Screen Manipulation

This feature allows you to manipulate the terminal screen, such as clearing it. The code sample demonstrates how to clear the screen and reset the cursor position.

const charm = require('charm')();
charm.pipe(process.stdout);
charm.erase('screen');
charm.position(0, 0);
charm.write('Screen cleared and cursor reset');

Other packages similar to charm

Keywords

FAQs

Package last updated on 07 Apr 2013

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