mirror of
https://github.com/HeyPuter/puter
synced 2024-11-14 22:06:00 +00:00
Center that launch logo
This commit is contained in:
parent
26c435c829
commit
007ebdadb1
@ -355,7 +355,17 @@ class WebServerService extends BaseService {
|
||||
} else break;
|
||||
}
|
||||
if ( last_logo ) {
|
||||
console.log('\x1B[34;1m' + last_logo.txt + '\x1B[0m');
|
||||
const lines = last_logo.txt.split('\n');
|
||||
const width = process.stdout.columns;
|
||||
const pad = (width - last_logo.sz) / 2;
|
||||
const asymmetrical = pad % 1 !== 0;
|
||||
const pad_left = Math.floor(pad);
|
||||
const pad_right = Math.ceil(pad) + (asymmetrical ? 1 : 0);
|
||||
for ( let i = 0 ; i < lines.length ; i++ ) {
|
||||
lines[i] = ' '.repeat(pad_left) + lines[i] + ' '.repeat(pad_right);
|
||||
}
|
||||
const txt = lines.join('\n');
|
||||
console.log('\n\x1B[34;1m' + txt + '\x1B[0m\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user