FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
OpenBitFun/scripts/console-style.cjs at main · GCWing/OpenBitFun · GitHub
GCWing
/
OpenBitFun
Public
Notifications
You must be signed in to change notification settings
Fork
227
Star
2.1k
Code
Issues
74
Pull requests
6
Discussions
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
OpenBitFun
/
scripts
/
console-style.cjs
Copy path
More file actions
More file actions
Latest commit
History
History
History
132 lines (113 loc) · 2.8 KB
Breadcrumbs
OpenBitFun
/
scripts
/
console-style.cjs
Copy path
File metadata and controls
132 lines (113 loc) · 2.8 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#!/usr/bin/env node
/**
* Console style utilities
* Unified log formatting and coloring
*/
const
colors
=
{
reset
:
'\x1b[0m'
,
bold
:
'\x1b[1m'
,
dim
:
'\x1b[2m'
,
black
:
'\x1b[30m'
,
red
:
'\x1b[31m'
,
green
:
'\x1b[32m'
,
yellow
:
'\x1b[33m'
,
blue
:
'\x1b[34m'
,
magenta
:
'\x1b[35m'
,
cyan
:
'\x1b[36m'
,
white
:
'\x1b[37m'
,
brightBlack
:
'\x1b[90m'
,
brightRed
:
'\x1b[91m'
,
brightGreen
:
'\x1b[92m'
,
brightYellow
:
'\x1b[93m'
,
brightBlue
:
'\x1b[94m'
,
brightMagenta
:
'\x1b[95m'
,
brightCyan
:
'\x1b[96m'
,
brightWhite
:
'\x1b[97m'
,
bgBlue
:
'\x1b[44m'
,
bgGreen
:
'\x1b[42m'
,
bgYellow
:
'\x1b[43m'
,
bgRed
:
'\x1b[41m'
,
bgCyan
:
'\x1b[46m'
,
bgMagenta
:
'\x1b[45m'
,
}
;
const
LINE_WIDTH
=
60
;
const
THIN_LINE
=
'-'
.
repeat
(
LINE_WIDTH
)
;
const
THICK_LINE
=
'='
.
repeat
(
LINE_WIDTH
)
;
const
DOUBLE_LINE
=
'═'
.
repeat
(
LINE_WIDTH
)
;
function
colorize
(
text
,
...
colorCodes
)
{
return
colorCodes
.
join
(
''
)
+
text
+
colors
.
reset
;
}
function
printHeader
(
title
)
{
console
.
log
(
''
)
;
console
.
log
(
colorize
(
THICK_LINE
,
colors
.
cyan
)
)
;
console
.
log
(
colorize
(
`
${
title
}
`
,
colors
.
bold
,
colors
.
cyan
)
)
;
console
.
log
(
colorize
(
THICK_LINE
,
colors
.
cyan
)
)
;
}
function
printSubHeader
(
title
)
{
console
.
log
(
''
)
;
console
.
log
(
colorize
(
THIN_LINE
,
colors
.
dim
)
)
;
console
.
log
(
colorize
(
`
${
title
}
`
,
colors
.
bold
,
colors
.
white
)
)
;
console
.
log
(
colorize
(
THIN_LINE
,
colors
.
dim
)
)
;
}
function
printSuccess
(
message
)
{
console
.
log
(
colorize
(
' [OK] '
,
colors
.
green
)
+
message
)
;
}
function
printInfo
(
message
)
{
console
.
log
(
colorize
(
' [--] '
,
colors
.
blue
)
+
message
)
;
}
function
printWarning
(
message
)
{
console
.
log
(
colorize
(
' [!!] '
,
colors
.
yellow
)
+
message
)
;
}
function
printError
(
message
)
{
console
.
log
(
colorize
(
' [XX] '
,
colors
.
red
)
+
message
)
;
}
function
printKeyValue
(
key
,
value
,
indent
=
2
)
{
const
spaces
=
' '
.
repeat
(
indent
)
;
console
.
log
(
spaces
+
colorize
(
key
+
':'
,
colors
.
dim
)
+
' '
+
colorize
(
String
(
value
)
,
colors
.
white
)
)
;
}
function
printListItem
(
text
,
indent
=
4
)
{
const
spaces
=
' '
.
repeat
(
indent
)
;
console
.
log
(
spaces
+
colorize
(
'-'
,
colors
.
dim
)
+
' '
+
text
)
;
}
function
printComplete
(
message
)
{
console
.
log
(
''
)
;
console
.
log
(
colorize
(
THICK_LINE
,
colors
.
green
)
)
;
console
.
log
(
colorize
(
`
${
message
}
`
,
colors
.
bold
,
colors
.
green
)
)
;
console
.
log
(
colorize
(
THICK_LINE
,
colors
.
green
)
)
;
console
.
log
(
''
)
;
}
function
printStep
(
step
,
total
,
message
)
{
const
stepText
=
`[
${
step
}
/
${
total
}
]`
;
console
.
log
(
colorize
(
stepText
,
colors
.
cyan
,
colors
.
bold
)
+
' '
+
message
)
;
}
function
printBlank
(
)
{
console
.
log
(
''
)
;
}
module
.
exports
=
{
colors
,
colorize
,
printHeader
,
printSubHeader
,
printSuccess
,
printInfo
,
printWarning
,
printError
,
printKeyValue
,
printListItem
,
printComplete
,
printStep
,
printBlank
,
THIN_LINE
,
THICK_LINE
,
DOUBLE_LINE
,
LINE_WIDTH
,
}
;
Back
|
FazBrowse Home
|
New Git URL