-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
96 lines (71 loc) · 2.85 KB
/
test.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
'use strict';
const concolor = require('./concolor.js');
console.log('Examples:\n');
console.log(concolor` Hello ${'World'}(i,black/green) italic black on green`);
console.log(concolor` Hello ${'World'}(blue) blue`);
console.log(concolor` Hello ${'World'}(/red) on red`);
console.log(concolor` Hello ${'World'}(white/yellow,b) bold white on yellow`);
console.log(concolor` Hello ${'World'}(b,i) bold italic`);
console.log(concolor` Hello ${'World'}(b,/blue) bold on blue`);
console.log(concolor` Hello ${'World'}(b,u,yellow) bold underline yellow`);
console.log(concolor` Hello ${'World'}(blue,u) blue underline`);
console.log(concolor` Hello ${'World'}(b,black/green) bold black on green`);
console.log('\nStyle examples:');
console.log(concolor`
${'b for bold'}(b),
${'f for faint'}(f),
${'i for italic'}(i),
${'u for underline'}(u),
${'l for blink slow'}(l),
${'h for blink rapid'}(h),
${'n for negative'}(n)
${'s for strikethrough'}(s)`);
console.log('\nComplex examples:');
console.log(concolor`
Client on ${'192.168.1.1'}(black/white)
connected to ${'SERVER'}(n,b,red)
at ${new Date().toUTCString()}(i,b,blue)
and variable with no style: ${'abc'}
`);
console.log('\nCreate semantic template tags:\n');
const warn = concolor('b,yellow');
const err = concolor('b,yellow/red');
const inf = concolor('i,white');
console.log(' ' + warn`test1 ${'text2'} text3`);
console.log(' ' + err`test4 ${'text5'} text6`);
console.log(' ' + inf`test7 ${'text8'} text9`);
console.log('\nUse tag as a funtion:\n');
console.log(' ' + warn(`test1 ${'text2'} text3`));
console.log(' ' + err(`test4 ${'text5'} text6`));
console.log(' ' + inf(`test7 ${'text8'} text9`));
console.log('\nShorthand:\n');
console.log(' ' + concolor.b('concolor.b'));
console.log(' ' + concolor.i('concolor.i'));
console.log(' ' + concolor.u('concolor.u'));
console.log(' ' + concolor.em('concolor.em'));
console.log(' ' + concolor.error('concolor.error'));
console.log(' ' + concolor.info('concolor.info'));
console.log(' ' + concolor.warn('concolor.warn'));
console.log(' ' + concolor.debug('concolor.debug'));
console.log(' ' + concolor.success('concolor.success'));
console.log(' ' + concolor.fail('concolor.fail'));
console.log(' ' + concolor.red('concolor.red'));
console.log(' ' + concolor.green('concolor.green'));
console.log(' ' + concolor.yellow('concolor.yellow'));
console.log(' ' + concolor.blue('concolor.blue'));
console.log(' ' + concolor.white('concolor.white'));
console.log('\nThemes:\n');
const theme = concolor({
caption: 'b,white',
text: 'green',
link: 'u,yellow',
});
const caption = 'Caption';
const text = 'Here is a text';
const link = 'http://metarhia.com';
console.log(theme` ${{ caption }}
${{ text }}
${{ link }}`);
console.log('\nThemes as functions:\n');
console.log(' ' + theme.caption('Caption example'));
console.log('\nPassed\n');