Add pretty print to hexdump#155
Conversation
|
Nice! I’m a pretty big fan of HexFiend on macOS which also added hex coloring based on hexyl, see this PR: Think if we base the coloring rules and scheme on that it would already be very nice. |
Thanks for the input @yunzheng, I have applied some rules from HexFriend in 9fa9977. I feel the white color of printable ASCII is somewhat calmer to read than a blue color. What do you think? Perhaps we could make this user customizable in the future, but for simplicity's sake for now I think we should settle on one coloring scheme. For example, a small PE file is now rendered like this:
|
|
That looks awesome, yes looking at the Hexyl example I think the white is much better on the eyes! |
Co-authored-by: Erik Schamper <1254028+Schamper@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #155 +/- ##
=====================================
Coverage 0.00% 0.00%
=====================================
Files 21 21
Lines 2438 2470 +32
=====================================
- Misses 2438 2470 +32
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|

This PR aims to provide a stub for pretty colors as described in #80. Currently only null bytes are 'greyed-out' and ASCII printable characters are whitened.
Perhaps we can look at some of these resources to determine what other coloring rules we would like to apply here:
Some things that come to mind:
0x09-0x0D,0x20, etc.)?0x80-0xFF)?The current implementation does not change the default behavior of
hexdump, using theprettyargument is required.