1.0.11 ā€¢ Published 5 years ago

colorlog-css v1.0.11

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

colorlog-css

npm version LICENSE

šŸŒˆ Colorize your ugly console.log with 198 Schemes and your CSS !

0 dependencies & 0 dependents light weight module :)

npm.io npm.io

Installation

npm install colorlog-css --save
yarn add colorlog-css

Usage

Javascript

var colorLog = require('colorlog-css')
var clg = new colorLog.default('./MyColors.css')
// var clg = new colorLog.default()
// clg.set('./MyColors.css')

clg.log('I want a default color')
clg.pri('But I wanna more pretty log')

TypeScript

import ColorLog from 'colorlog-css'

const clg = new ColorLog('./MyColors.css')
// const clg = new ColorLog()
// clg.set('./MyColors.css')

clg.list()
clg.suc('cess :)')
clg
  .join()
  .log('log')
  .pri('pri')
  .sec('sec')
  .suc('suc')
  .danger('danger')
  .warn('warn')
  .info('info')
  .end()

npm.io

There are already 198 schemes based on the iterm-scheme list and 3/4 bit default style. You can easily modify your color with these predefined colors and your CSS.

clg.list() // Will show the default 3/4 bit style list.
clg.listScheme() // List schemes with methods of scheme applied.

import { Schemes } from 'colorlog-css'
// Schemes will applied to the methods šŸ•¶
clg.setScheme(Schemes.Batman)

How to change color ?

Make a CSS file for customizing your own color :)

  • Selectors
    • Class Format ( Each selector will represent method's color)
      • .primary
      • .secondary
      • .success
      • .danger
      • .warning
      • .info
      • .default
    • Id Format
      • #pre
        • val ( property represent the value of prefix )
/* SAMPLE */

.success {
  background: #00bc80;
  color: rgb(255, 255, 255);
}

/* .default #pre {
  background: null;
  color: #ffffff;
  val: *Default*;
} */

.primary #pre {
  background: rgb(0, 115, 216);
  color: rgb(255, 255, 255);
  val: šŸŒˆ HEY;
}

.secondary #pre {
  background: #514636;
  color: rgb(235, 244, 255);
  val: ā˜•ļø Hmm..;
}

.success #pre {
  background: #58ff82;
  color: rgb(33, 33, 33);
  val: āœ… Great !;
}

.danger #pre {
  background: #ff7dab;
  color: rgb(0, 0, 0);
  val: šŸ”„ šŸ”„ WATCH OUT;
}

.warning #pre {
  background: #ffdc2e;
  color: rgb(0, 0, 0);
  val: šŸ’© Shit;
}

.info #pre {
  background: rgba(0, 170, 189, 0.612);
  color: rgb(255, 255, 255);
  val: ā­ļø __NOTE__ ā­ļø;
}
import ColorLog from 'colorlog-css'

const clg = new ColorLog('./MyColors.css')
clg
  .join()
  .log('log')
  .pri('pri')
  .sec('sec')
  .suc('suc')
  .danger('danger')
  .warn('warn')
  .info('info')
  .end()

or programmatically,

import ColorLog, { Colors, Style } from 'colorlog-css'

const clg = new ColorLog('./MyColors.css')

clg.info('You can change the color like this', '\n\n')

clg.danger('danger')

// Apply only background
clg.categories.danger.color = clg.makeForm(null, '#ff4757')
clg.danger('danger')

// Apply styles and colors
clg.categories.danger.color = clg.makeForm(
  [Colors.Magenta, Style.Italic, Style.Bold],
  '#7bed9f'
)
clg.danger('danger')

Output will look like this āœØ

npm.io

TODO...

  • Make it available to customize default color set.
    • Customize it with schemes / inputing the value directly.
  • Change font styles with string or string[] types
  • Any ideas? šŸ˜„

Any questions or suggestions are always welcome šŸ€

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago