node-styl

0.0.6 • Public • Published

node-styl

simple bash console syling

Install :

npm install node-styl

Add colors and styles to your logs :

 
const styl = require('node-styl');
...
console.log("i can be "+styl("red").red.bold);
console.log("or "+styl(" black ").black.whiteBG);

Use preformated style :

...
var title = styl().green.bold.blueBG.text;
console.log("this is "+title(" A TITLE "));
console.log("this is "+title(" AN OTHER TITLE "));

Clean rendered styles to handle text length :

...
var styled = styl("this is ").green.bold+""+title(" A TITLE ");
var text = styl.none(styled);
console.log("styled=","'"+styled+"'",' length=',text.length);

NB: styled text should be at least merged with an empty string to render.

available style properties are :

  • styles :
    • bold
    • italic
    • underline
    • inverse
    • strikethrough
  • text colors :
    • white
    • grey
    • black
    • blue
    • cyan
    • green
    • magenta
    • red
    • yellow
  • background colors :
    • whiteBG
    • greyBG
    • blackBG
    • blueBG
    • cyanBG
    • greenBG
    • magentaBG
    • redBG
    • yellowBG

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i node-styl

      Weekly Downloads

      4

      Version

      0.0.6

      License

      ISC

      Unpacked Size

      3.4 kB

      Total Files

      3

      Last publish

      Collaborators

      • yorg