-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule.js
More file actions
38 lines (31 loc) · 785 Bytes
/
module.js
File metadata and controls
38 lines (31 loc) · 785 Bytes
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
'use strict';
module.exports= function(text,type){
/**
* Tüm renk ve niteleyici kodları için kaynaklar kısmında link mevcut
*/
var style = {
bold: [1, 22],
underline: [4, 24],
black: [30, 39],
red: [31, 39],
green: [32, 39],
bgBlack: [40, 49],
bgRed: [41, 49],
bgGreen: [42, 49],
bgYellow: [43, 49],
bgBlue: [44, 49]
}
function wrap(args) {
style = style[type];
/**
* Aslında yaptığımı şey => \u001b[31m text \u001b[m39
* bu bize kırmızı renkte bir çıktı verecektir.
*/
var tags = {
open: '\u001b[' + style[0] + 'm',
close: '\u001b[' + style[1] + 'm'
}
return tags.open + args + tags.close
}
return wrap(text)
};