-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
52 lines (49 loc) · 986 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* CLI WELCOME */
import chalk from "chalk";
const dim = chalk.dim;
import clearConsole from "clear-any-console";
/**
* Welcome.
*
* @param String heading Heading text.
* @param String subHeading Sub heading text.
* @param Object options Configurable options.
*/
export default (options = {}) => {
// Options.
const defaultOptions = {
title: 'ADD A HEADING',
tagLine: '',
description: '',
bgColor: '#ffffff',
color: '#000000',
bold: true,
clear: true,
version: ''
};
const opts = {...defaultOptions, ...options};
const {
title,
tagLine,
description,
bgColor,
color,
bold,
clear,
version
} = opts;
// Configure.
const bg = bold
? chalk.hex(bgColor).inverse.bold
: chalk.hex(bgColor).inverse;
const clr = bold ? chalk.hex(color).bold : chalk.hex(color);
clear && clearConsole();
// Do it.
console.log();
console.log(
`${clr(`${bg(` ${title} `)}`)} v${version} ${dim(tagLine)}\n${dim(
description
)}`
);
console.log();
};