New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

web-chalk

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web-chalk

Print beautiful words on the console

latest
npmnpm
Version
1.1.0
Version published
Weekly downloads
13
333.33%
Maintainers
1
Weekly downloads
 
Created
Source

web-chalk

Print beautiful words on the console web-chalk

Installing

$ npm install web-chalk --save

Usage

ready

  • require
var webChalk = require('web-chalk');
  • or
<script src='./web-chalk.min.js' type="text/javascript"></script>

go

  • make a pattern of strings
var str = "\n\
        ██          ███████         ███████\n\
      ██  ██        ██     ██     ██\n\
     ██ ▄▄ ██       ███████       ██\n\
    ██      ██      ██     ██     ██\n\
   ██        ██     ███████         ███████   A  B  C\n\
    "
  • add color
var str_ = "\n\
        <b>██</b>          <r>███████</r>         <g>███████</g>\n\
      <b>██  ██</b>        <r>██     ██</r>     <g>██</g>\n\
     <b>██ ▄▄ ██</b>       <r>███████</r>       <g>██</g>\n\
    <b>██      ██</b>      <r>██     ██</r>     <g>██</g>\n\
   <b>██        ██</b>     <r>███████</r>         <g>███████</g>  <b>A</b> <r>B</r> <g>C</g>\n\
    "
  • define the class name in a css Object, the string wrapped by the class name tag will have the color of the corresponding class name
var cssClass = {
    b: {
        color: 'rgb(29,174,229)'
    },
    bl: {
        color: 'rgb(67,81,84)'
    },
    r: {
        color: 'rgb(218,14,26)'
    },
    g: {
        color: 'rgb(171,204,3)'
    },
    gr: {
        color: 'rgb(92,104,104)'
    }
}
  • a string that is not wrapped by a tag will use the default style, and you can also customize the default style
var defaultCss = {
  color:'gray'
}
  • output
// params:(target[string], config[object])
// config: {style[object], default[object]?}
webChalk(str, {
    style: cssClass,
    default: defaultCss
});

If your entire string style is the same,You can omit the style parameter

webChalk(str,  {
    default: defaultCss
});

others methods

  • webChalk.log('abc')
  • webChalk.warn('abc')
  • webChalk.error('abc')
  • webChalk.info('abc')

License:

MIT

Keywords

console

FAQs

Package last updated on 06 Sep 2017

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