-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscreen.js
More file actions
85 lines (78 loc) · 1.67 KB
/
screen.js
File metadata and controls
85 lines (78 loc) · 1.67 KB
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
const blessed = require('blessed');
const contrib = require('blessed-contrib');
var program = blessed.program();
program.key('q', function(ch, key) {
program.clear();
program.disableMouse();
program.showCursor();
program.normalBuffer();
process.exit('userEnded');
});
var terminalWidth = process.stdout.columns;
var terminalHeight = process.stdout.rows;
var screenWidth;
var screenHeight;
if (terminalHeight < 30){
screenWidth = '80%';
screenHeight = '75%';
} else {
screenWidth = '80%';
screenHeight = '80%';
}
function getScreen(){
var screen = blessed.screen();
screen.title = 'Hash-gen';
return screen;
}
function getInfoBox(){
var infoBox = blessed.box({
top: 'center',
left: 'center',
width: `${screenWidth}`,
height: `${screenHeight}`,
content: ``,
tags: true,
padding: 2,
border: {
type: 'line'
},
style: {
fg: 'black',
bg: 'green',
transparent: false,
border: {
fg: '#f0f0f0'
}
}
});
return infoBox;
}
function getProgressBar(){
var progress = blessed.progressbar({
border: 'line',
style: {
fg: 'blue',
bg: 'default',
bar: {
bg: 'default',
fg: 'green'
},
border: {
fg: 'default',
bg: 'default'
}
},
ch: ':',
width: '40%',
height: 3,
top: 1,
left: 'center',
filled: 0
});
return progress
}
module.exports = {
getScreen: getScreen,
getInfoBox: getInfoBox,
getProgressBar: getProgressBar
};