
Simon LawandGitHub
6db30a10f7
cmd/tailscale: shrink QR codes using half blocks (#17084)
When running `tailscale up --qr`, the QR code is rendered using
two full blocks ██ to form a square pixel. This is a problem for
people with smaller terminals, because the output is 37 lines high.
All modern terminals support half block characters, like ▀ and ▄,
which only takes 19 lines and can easily fit in a regular terminal
window.
For example, https://login.tailscale.com/a/0123456789 is now rendered:
```
user@host:~$ tailscale up --qr
█████████████████████████████████████
█████████████████████████████████████
████ ▄▄▄▄▄ █ ▀▀ █▄▀▀ ▄ █ ▄▄▄▄▄ ████
████ █ █ █▀ ▄▄▄█▀█▄▀ ▄█ █ █ ████
████ █▄▄▄█ ██▄ ▄▀▀▄▄ ▀▀ ▀█ █▄▄▄█ ████
████▄▄▄▄▄▄▄█ ▀▄▀ █▄▀▄▀▄█ █▄▄▄▄▄▄▄████
████▄█▄ ▀▄▄▄█▀▄█▀ ▀▄ ▄ ▀▀ ▀▀▄█▄ ████
████▄▀▄▀▄█▄ █ ▄▄▄▄█▀██▀██▄▄█▀█▄▄▀████
████▄█▀ ▀ ▄█▄▄▀▄▀█ ▄ ▄█▀█▄▀██▄ ▀▀████
█████▀ ▀ ▄▀▀▀▀▄▀▄▀▀ ▄▄ ▄ ▀ █▄ ▄████
██████ ▄▄█▄▄▄▄▄▀ █ ▄▀▀▄█▀ █ ▄ ▀ █████
████▄█▄▄ ▄▀ ▀██▀ ▄█▀▀████▄▀█ ██████
█████▄▄▄█▄▄▄▀▀ █▄▄▄▄▄ ▀█ ▄▄▄ ▀▀████
████ ▄▄▄▄▄ █ ██▄ ▀ █▀█ ▄ █▄█ █▄█████
████ █ █ █▀ █ ▀█▄▄ █▀ ▄ ▀▄▀▄████
████ █▄▄▄█ █▄█▀█▄▀██▀██▄ ▀█▄▀▀▄▀▄████
████▄▄▄▄▄▄▄█▄▄███▄▄▄███▄▄▄██▄██▄█████
█████████████████████████████████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
```
To render a QR code with full blocks, like we did in the past, use the
new `--qr-format` flag:
```
user@host:~$ tailscale up --qr --qr-format=large
██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████
████████ ██ ████ ██ ████ ██ ████████
████████ ██████████ ██ ████ ██ ██ ██████████ ████████
████████ ██ ██ ████ ██████ ██ ██ ██ ██ ████████
████████ ██ ██ ██ ████████ ████ ████ ██ ██ ████████
████████ ██ ██ ████ ████ ████ ████ ██ ██ ████████
████████ ██████████ ██████ ██ ████ ██ ██████████ ████████
████████ ██ ██ ██ ██ ██ ██ ██ ██ ████████
████████████████████████ ██ ████ ██ ████ ████████████████████████
████████ ██ ██ ████ ████ ██ ████ ████ ██ ████████
██████████████ ████████ ████ ██ ██ ██████ ████████
████████ ██ ██ ██ ██ ██████████████ ██████ ██████████
██████████ ██ ██████ ██ ██████████ ████ ██████████ ██████ ████████
████████ ████ ██ ██ ██ ████ ██████ ██████ ████████████
████████████ ████████ ██ ██ ██ ████ ████ ██████ ████████
████████████ ██ ████████ ██ ████ ██ ██ ████████
██████████ ██ ██ ██ ████ ██ ████ ██████████
████████████ ██ ██ ██ ████ ████ ██ ██ ██████████
████████████ ████████████████ ██ ██ ████ ██ ██ ██████████
████████ ██ ██ ████████ ██████████████ ████ ████████████
████████████████ ██ ████ ████ ██████████ ██ ████████████
██████████ ██ ████ ██ ████ ████████████
████████████████████████ ████████████ ██ ██████ ████████
████████ ██ ████ ██ ██████ ██ ██ ██ ██████████
████████ ██████████ ██ ██████ ██ ██ ██ ██████ ██████████████
████████ ██ ██ ████ ██ ████ ████ ██ ██ ████████
████████ ██ ██ ██ ██ ██████ ██ ██ ██ ██████████
████████ ██ ██ ██ ██████ ████████████ ████ ████ ██ ████████
████████ ██████████ ██████ ████ ████ ██████ ████ ██ ██████████
████████ ██ ██████ ██████ ████ ████ ██████████
██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████
```
Fixes #17083
Signed-off-by: Simon Law <sfllaw@tailscale.com>
2025-09-16 15:49:03 -07:00
..
2025-01-07 13:05:37 -08:00
2023-12-07 20:57:31 -05:00
2024-12-02 10:30:46 +01:00
2025-08-14 13:46:48 -07:00
2023-12-15 09:29:42 -08:00
2025-09-04 12:40:55 +01:00
2025-09-12 12:51:45 -07:00
2025-08-16 09:42:25 -04:00
2025-08-15 16:27:46 -05:00
2025-09-15 09:21:27 -07:00
2025-02-18 10:23:04 -06:00
2025-06-16 13:35:38 -07:00
2025-03-04 08:47:35 -07:00
2024-06-10 17:57:22 +01:00
2025-09-16 11:35:49 -07:00
2025-08-22 16:07:05 +01:00
2023-03-01 15:45:12 -07:00
2023-08-03 13:00:45 -07:00
2023-02-18 05:21:05 +00:00
2025-04-07 19:24:51 -07:00
2025-08-20 14:04:28 -07:00
2024-04-16 15:32:38 -07:00
2023-03-13 08:44:25 -07:00
2025-09-16 11:35:49 -07:00
2025-02-05 14:41:42 -08:00
2023-02-11 17:57:36 +00:00
2025-06-18 14:20:39 -07:00
2025-06-16 13:35:38 -07:00
2025-04-08 10:07:47 -07:00
2023-01-27 15:36:29 -08:00
2025-01-31 16:36:39 -06:00
2024-12-06 14:27:52 -05:00
2025-08-26 07:44:26 -07:00
2024-09-09 18:42:13 -07:00
2023-08-24 15:42:35 -07:00
2025-08-05 09:19:49 -07:00
2025-09-16 15:49:03 -07:00
2025-09-16 14:11:15 -07:00
2024-04-16 15:32:38 -07:00
2025-06-20 06:11:11 -07:00
2025-02-05 14:41:42 -08:00
2025-09-16 11:25:29 -04:00
2025-09-16 11:35:49 -07:00
2023-01-27 15:36:29 -08:00
2025-02-05 14:41:42 -08:00
2025-08-27 09:58:59 -07:00
2025-03-29 11:02:42 -07:00
2025-03-18 16:57:04 -07:00