Skip to content

Commit 6724b85

Browse files
committedMar 1, 2022
unicode blocks don't work on MacOS so switch back to ANSI colors
1 parent 114ea85 commit 6724b85

File tree

1 file changed

+4
-26
lines changed

1 file changed

+4
-26
lines changed
 

‎bin/servez

+4-26
Original file line numberDiff line numberDiff line change
@@ -20,41 +20,19 @@ const log = {
2020
};
2121

2222
function genQRCode(s) {
23-
const blockChars = [
24-
' ', // 0
25-
'▘', // 1
26-
'▝', // 2
27-
'▀', // 3
28-
'▖', // 4
29-
'▌', // 5
30-
'▞', // 6
31-
'▛', // 7
32-
'▗', // 8
33-
'▚', // 9
34-
'▐', // 10
35-
'▜', // 11
36-
'▄', // 12
37-
'▙', // 13
38-
'▟', // 14
39-
'█', // 15
40-
];
4123

4224
const qr = QrCode.encodeText(s, Ecc.MEDIUM);
4325
const size = ((qr.size + 1) / 2 | 0) * 2 + 2;
4426

4527
const lines = [];
46-
for (let y = -2; y < size; y += 2) {
28+
for (let y = -2; y < size; ++y) {
4729
const line = [];
48-
for (let x = -2; x < size; x += 1) {
49-
const code = (qr.getModule(x + 0, y + 0) ? 1 : 0) |
50-
(qr.getModule(x + 0, y + 0) ? 2 : 0) |
51-
(qr.getModule(x + 0, y + 1) ? 4 : 0) |
52-
(qr.getModule(x + 0, y + 1) ? 8 : 0) ;
53-
line.push(blockChars[code]);
30+
for (let x = -2; x < size; ++x) {
31+
line.push(c[qr.getModule(x, y) ? 'bgBlack' : 'bgWhite'](' '));
5432
}
5533
lines.push(line.join(''));
5634
}
57-
return c.bgWhite(c.black(lines.join('\n')));
35+
return lines.join('\n');
5836
}
5937

6038
const optionSpec = {

0 commit comments

Comments
 (0)
Please sign in to comment.