Center that launch logo

This commit is contained in:
KernelDeimos 2024-03-30 19:35:11 -04:00
parent 26c435c829
commit 007ebdadb1

View File

@ -355,7 +355,17 @@ class WebServerService extends BaseService {
} else break; } else break;
} }
if ( last_logo ) { 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');
} }
} }
} }