-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyles.js
34 lines (32 loc) · 893 Bytes
/
styles.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
// ANSI styles
// usage: console.log(style.color(255,0,255),'▷',style.reset,style.color(39),expect.getState().currentTestName,style.hr.double,style.reset); });
const style = {
reset: '\x1b[0m',
bold: '\x1b[1m',
italic: '\x1b[3m',
underline: '\x1b[4m',
dblUnderline: '\x1b[21m',
dim: '\x1b[2m',
invert: '\x1b[7m',
black: '\x1b[30m',
red: '\x1b[31m',
green: '\x1b[32m',
yellow: '\x1b[33m',
blue: '\x1b[34m',
magenta: '\x1b[35m',
cyan: '\x1b[36m',
white: '\x1b[37m',
primaryFont: '\x1b[10m',
strike: '\x1b[9m',
hr: {
double: `\n${'═'.repeat(process.env.COLUMNS - 1)}`,
single: `\n${'─'.repeat(process.env.COLUMNS - 1)}`
},
color(r,g,b) {
return g === undefined ? `\x1b[38;5;${r}m` : `\x1b[38;2;${r};${g};${b}m`;
},
bgColor(r,g,b) {
return g === undefined ? `\x1b[48;5;${r}m` : `\x1b[48;2;${r};${g};${b}m`;
},
}
export {style}