|
| 1 | +// ASCII banner, edited as two parallel grids. |
| 2 | +// |
| 3 | +// SHAPE holds the raw glyphs (braille art + figlet text). Leave these alone |
| 4 | +// unless you want to change the art itself. |
| 5 | +// |
| 6 | +// COLORS is the paint map. Each character corresponds 1:1 to the character |
| 7 | +// at the same position in SHAPE: |
| 8 | +// B = blue (#1a4fd0) — the sphere |
| 9 | +// S = silver (#e5e7eb) — the rings and the "Bitsocial" text |
| 10 | +// . = no color (pass the glyph through as-is; use this for spaces) |
| 11 | +// |
| 12 | +// To retouch the art, find a glyph in SHAPE, then flip the character at the |
| 13 | +// same column in the matching COLORS row. A common case: a ring cell came out |
| 14 | +// blue because the sphere mask had more dots there — change its 'B' to 'S'. |
| 15 | +// |
| 16 | +// Both grids MUST have the same number of rows. Each row in COLORS must be at |
| 17 | +// least as wide as the corresponding SHAPE row (extra chars are ignored). |
| 18 | +// Palette sourced from bitsocialnet/bitsocial-web/about/tailwind.config.ts. |
| 19 | + |
| 20 | +const SHAPE = [ |
| 21 | + " ⢀⣴⣿⣿⣦⡀ ", |
| 22 | + " ⣾⣿⠁⠈⣿⣷⡀ ", |
| 23 | + " ⢸⣿⡇ ⢸⣿⣇ ", |
| 24 | + " ⢀⣀⣼⣿⣷⣶⣶⣶⣿⣿⣄⡀ ", |
| 25 | + " ⢀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣤⡀ ", |
| 26 | + " ⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦ 888888b. d8b 888 d8b 888", |
| 27 | + " ⢀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡀ 888 \"88b Y8P 888 Y8P 888", |
| 28 | + " ⣀⣤⣤⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣶⣦⣤⣀ 888 .88P 888 888", |
| 29 | + "⣰⣿⡿⠛⠉⠉ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⠉⠉⠛⠟⣿⣦ 8888888K. 888 888888 .d8888b .d88b. .d8888b 888 8888b. 888", |
| 30 | + "⠻⣷⣦⣤⣀⣀ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿ ⢀⣀⣀⣴⣿⠟ 888 \"Y88b 888 888 88K d88\"\"88b d88P\" 888 \"88b 888", |
| 31 | + " ⠉⠛⠻⠿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠿⠟⠛⠉ 888 888 888 888 \"Y8888b. 888 888 888 888 .d888888 888", |
| 32 | + " ⠈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿ 888 d88P 888 Y88b. X88 Y88..88P Y88b. 888 888 888 888", |
| 33 | + " ⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟ 8888888P\" 888 \"Y888 88888P' \"Y88P\" \"Y8888P 888 \"Y888888 888", |
| 34 | + " ⠈⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠟⠁ ", |
| 35 | + " ⠉⠛⢿⣿⣿⣿⣿⣿⣿⣿⠛⠉ ", |
| 36 | + " ⢸⣿⡆ ⣿⡿ ", |
| 37 | + " ⠈⢿⣷⡀⣸⣿⠃ ", |
| 38 | + " ⠈⠿⣿⡿⠃ " |
| 39 | +]; |
| 40 | + |
| 41 | +const COLORS = [ |
| 42 | + "................SSSSSS.......................................................................................", |
| 43 | + "................SSSSSSS......................................................................................", |
| 44 | + "...............SSSSSSSS......................................................................................", |
| 45 | + ".............BBBBBBBBSSBB....................................................................................", |
| 46 | + "..........BBBBBBBBBBBSSBBBBB.................................................................................", |
| 47 | + ".........BBBBBBBBBBBBSSBBBBBB...............SSSSSSSS...SSS.SSS...............................SSS..........SSS", |
| 48 | + ".......BBBBBBBBBBBBBBSSBBBBBBBB.............SSS..SSSS..SSS.SSS...............................SSS..........SSS", |
| 49 | + "..SSSSSBBBBBBBBBBBBBBSSBBBBBBBBSSSSSSS......SSS..SSSS......SSS............................................SSS", |
| 50 | + "SSSSSS.BBBBBBBBBBBBBBSSBBBBBBBBSSSSSSS......SSSSSSSSS..SSS.SSSSSS.SSSSSSS...SSSSSS...SSSSSSS.SSS..SSSSSS..SSS", |
| 51 | + "SSSSSS.BBBBBBBBBBBBBBSSBBBBBBBBSSSSSSS......SSS..SSSSS.SSS.SSS....SSS......SSSSSSSS.SSSSS....SSS.....SSSS.SSS", |
| 52 | + "..SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS......SSS....SSS.SSS.SSS....SSSSSSSS.SSS..SSS.SSS......SSS.SSSSSSSS.SSS", |
| 53 | + ".......BBBBBBBBBBBBBBSSBBBBBBBBBBBBBBB......SSS...SSSS.SSS.SSSSS.......SSS.SSSSSSSS.SSSSS....SSS.SSS..SSS.SSS", |
| 54 | + ".........BBBBBBBBBBBBSSBBBBBBBBB............SSSSSSSSS..SSS..SSSSS..SSSSSSS..SSSSSS...SSSSSSS.SSS.SSSSSSSS.SSS", |
| 55 | + "..........BBBBBBBBBBBSSBBBBBBB...............................................................................", |
| 56 | + ".............BBBBBBBBSSBBBB..................................................................................", |
| 57 | + "...............SSSSSSSSS.....................................................................................", |
| 58 | + "...............SSSSSSSS......................................................................................", |
| 59 | + "................SSSSSS......................................................................................." |
| 60 | +]; |
| 61 | + |
| 62 | +const BLUE = "\x1b[38;2;26;79;208m"; |
| 63 | +const SILVER = "\x1b[38;2;229;231;235m"; |
| 64 | +const RESET = "\x1b[0m"; |
| 65 | + |
| 66 | +function paint(shape: string, colors: string): string { |
| 67 | + let out = ""; |
| 68 | + let current = "."; |
| 69 | + for (let i = 0; i < shape.length; i++) { |
| 70 | + const glyph = shape[i]!; |
| 71 | + const want = colors[i] ?? "."; |
| 72 | + if (want !== current) { |
| 73 | + if (current !== ".") out += RESET; |
| 74 | + if (want === "B") out += BLUE; |
| 75 | + else if (want === "S") out += SILVER; |
| 76 | + current = want; |
| 77 | + } |
| 78 | + out += glyph; |
| 79 | + } |
| 80 | + if (current !== ".") out += RESET; |
| 81 | + return out; |
| 82 | +} |
| 83 | + |
| 84 | +function supportsColor(): boolean { |
| 85 | + if (process.env["NO_COLOR"]) return false; |
| 86 | + if (process.env["FORCE_COLOR"]) return true; |
| 87 | + return Boolean(process.stdout.isTTY); |
| 88 | +} |
| 89 | + |
| 90 | +export function printBanner(): void { |
| 91 | + const useColor = supportsColor(); |
| 92 | + const lines = SHAPE.map((row, i) => (useColor ? paint(row, COLORS[i] ?? "") : row)); |
| 93 | + process.stdout.write(lines.join("\n") + "\n\n"); |
| 94 | +} |
0 commit comments