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

style

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

style

color in your node.js console, without monkeypatching

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
589
decreased by-42.7%
Maintainers
0
Weekly downloads
 
Created
Source

colors.js - get color and style in your node.js console like what

   var sys = require('sys');
   var style = require('style');

   sys.puts(style('hello').green); // outputs green text
   sys.puts(style('i like cake and pies').underline.red) // outputs red underlined text
   sys.puts(style('inverse the color').inverse); // inverses the color
   sys.puts(style('OMG Rainbows!').rainbow); // rainbow (ignores spaces)
   

##disable style, for plain output

   style = require('style').enable(false) //... which you may want to do at some point!
   
   sys.puts(style('hello').green); // plain text
   sys.puts(style('i like cake and pies').underline.red) // plain text
   sys.puts(style('inverse the color').inverse); // plain text
   sys.puts(style('OMG Rainbows!').rainbow); // plain text
   
   //ALSO: does not monkeypatch string with 13 new properties!
   

ALSO! pad your strings:

style("hello").lpad(20)
"               hello"
style("goodbye").rpad(20,".")
"goodbye.............."

you can even style you padding

style("goodbye").rpad(20,style(".").grey)

style is aware of it self, and will style the pading as one chunk.
when style is disabled, padding will still be the same size.

remove style information:

style.destyle( 'styled string' )
  

##colors and styles!##

  • bold
  • italic
  • underline
  • inverse
  • yellow
  • cyan
  • white
  • magenta
  • green
  • red
  • grey
  • blue
  • black

run tests

>npm install expresso
>expresso style.expresso.js

Authors

Alexis Sellier (cloudhead) , Marak Squires , Justin Campbell, Dominic Tarr

FAQs

Package last updated on 19 Feb 2011

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