diff options
| author | Simon Law <sfllaw@tailscale.com> | 2025-09-16 15:49:03 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-16 15:49:03 -0700 |
| commit | 6db30a10f7a160efeaeeb955e92569c767ca8b2d (patch) | |
| tree | 6cdad49264e58e36ee43b7e09cd38f2feefb0677 /control/controlknobs | |
| parent | e180fc267b2fab61641bce08d075ad3e52b97a97 (diff) | |
| download | tailscale-6db30a10f7a160efeaeeb955e92569c767ca8b2d.tar.xz tailscale-6db30a10f7a160efeaeeb955e92569c767ca8b2d.zip | |
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>
Diffstat (limited to 'control/controlknobs')
0 files changed, 0 insertions, 0 deletions
