Repository navigation
fix(cycles): draw the payment QR code black on white on any terminal theme - #828
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused change preserves existing layout and fallback behavior, with no unresolved findings.
No open issues 🎉
What changed in this PR
Makes the icp cycles buy payment QR code readable across terminal themes without replacing the existing renderer.
Changes:
- Applies fixed black and white colours to each row, resetting afterward.
- Preserves plain-output fallback and terminal-size checks.
- Adds a regression test and changelog entry.
| File | Description |
|---|---|
| crates/icp-cli/src/commands/cycles/buy.rs | Adds conditional QR colouring and a row-by-row regression test. |
| CHANGELOG.md | Documents the QR readability fix. |
Review effort: Balanced
lwshang
approved these changes
Oct 19, 2026
raymondk
force-pushed
the
cycles-buy/04-qr-colours
branch
2 times, most recently
from
October 20, 2026 15:45
d6f64fb to
a2fa343
Compare
…theme The code was drawn in the terminal's own colours, so a light theme inverted it and a dark theme often gave grey on near-black, and many phone cameras read neither. When stderr has colour support, every row is now set to 256-colour palette entry 231 (white) on entry 16 (black), which sit in the fixed colour cube that themes do not remap, and reset at its end. The terminal-size fit check still measures the plain drawing. Without colour support the plain drawing is printed as before, so the worst case is unchanged. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Twxau844tMTwyHpQJEbmBo
raymondk
force-pushed
the
cycles-buy/04-qr-colours
branch
from
October 20, 2026 17:45
a2fa343 to
f9711db
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The payment QR code was drawn in the terminal's own colours, so a light theme inverted it and a dark theme often gave grey on near-black; many phone cameras read neither.
When stderr has colour support, every row of the drawing is now set to 256-colour palette entry 231 (white) on entry 16 (black), which sit in the fixed colour cube that themes do not remap, and reset at its end. The
qrcodecrate still does the encoding and the half-block layout; this only wraps its rows. The terminal-size fit check still measures the plain drawing. Without colour support the plain drawing is printed as before, so the worst case is today's output.This is the small alternative to #824's hand-rolled coloured renderer. Unit test
the_qr_code_is_coloured_black_on_white_row_by_row.Part of restacking #824 into small PRs, one fix each, stacked on
mainin this order:cycles-buy/01-json-implies-yes→02-arg-group→03-gateway→04-qr-colours→05-paste-flags→ then the wait, its follow-up text and the--jsonfields. Each PR targets the one below it; after the one below merges, retarget tomain.🤖 Generated with Claude Code
https://claude.ai/code/session_01Twxau844tMTwyHpQJEbmBo