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

smallchalk

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smallchalk

Like Chalk.js, but smaller and with fewer features

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

npm version

npm i smallchalk / yarn add smallchalk

smallchalk

Core functionality like Chalk.js but with fewer features. Meant for rapid prototyping without worrying about package.json bloat.

Details

  • Chain methods/getters like in Chalk.js:
const smChalk = require('smallchalk');

smChalk.bgRed.black.bold.underline("Lorem ipsum dolor sit amet");
  • The last color in the chain is what gets used:
// This line..
smChalk.red.green.blue.bgRed.bgBlack.bgYellow("Lorem ipsum dolor sit amet");
// ...is equivalent to this line
smChalk.blue.bgYellow("Lorem ipsum dolor sit amet");


// This line..
smChalk.red.blue("Lorem ipsum dolor sit amet");
// ...is equivalent to this line
smChalk.blue("Lorem ipsum dolor sit amet");

Properties

  • Foreground Colors:

    • black
    • red
    • green
    • yellow
    • blue
    • magenta
    • cyan
    • white
  • Background Colors:

    • bgBlack
    • bgRed
    • bgGreen
    • bgYellow
    • bgBlue
    • bgMagenta
    • bgCyan
    • bgWhite
  • Formatting:

    • bold
    • light
    • italic
    • underline
    • blink
    • inverse
    • hidden

Why?

Two reasons...

I wanted to understand:

  • How Chalk.js was able to use properties with the same name as both a getter and method on the same object
    • For example, you can do chalk.blue('foo'); and chalk.blue.bold('foo'); (.blue is being used as both a method and getter)
  • How Chalk.js was able to chain these properties/methods/getters

While modified, some of the code in this repo may resemble Chalk.js as I followed the same logic.

Keywords

FAQs

Package last updated on 15 Apr 2020

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