Live data from Hacker News

Your hex editor should color-code bytes

simonomi.dev

71–80 of 165 posts

Re: Your hex editor should color-code bytes

#72
This was a great article and inspired me to add support for binary files in `peek`.

https://soegaard.github.io/peek/#%28part._binary-files%29

For me the key insight is that similar values should get similar colors. And since Fx and 0x are "similar" the color palette should be cyclic.

Re: Your hex editor should color-code bytes

#74
post #23

For anyone who regularly has to look at/analyze binary files, i highly recommend ImHex [1]. Its a hex editor built with imgui and has a lot of built in tools. Imo the best feature is the data structure editor. You can write a data type definition similar to C and it overlays it on the hexdump and parses it in a structured way while you type. It also has a node based editor. 1: https://github.com/WerWolv/ImHex

Does it do color highlighting by value of hex bytes, though?

Yes.

https://docs.werwolv.net/imhex#screenshots

Re: Your hex editor should color-code bytes

#75
post #23

For anyone who regularly has to look at/analyze binary files, i highly recommend ImHex [1]. Its a hex editor built with imgui and has a lot of built in tools. Imo the best feature is the data structure editor. You can write a data type definition similar to C and it overlays it on the hexdump and parses it in a structured way while you type. It also has a node based editor. 1: https://github.com/WerWolv/ImHex

ImHex++. I also can’t help but shill for 010 Editor, a commercial alternative that one might describe as a little less opinionated.

Re: Your hex editor should color-code bytes

#76
post #45
post #39

Earlier quoted context omitted.

8% of the male population has some form of colorblindness (for women it’s around 0.5%). I have deuteranomaly colorblindness. If you search for images on the internet related to that type of colorblindness you’ll find representations of how we see color and how we see the world. It is not a fun condition to have, and leads to lots of problems in my everyday life. This blog post accidentally accentuated that issue, sin…

>1 in 12 men and 1 in 200 women go through the same sorts of experiences, and it’s worth it, if you aren’t color Not the same, it's a gradient.

Some people lack in vision, some lack in reading and some lack in stopping themselves to reply to comments misunderstanding others.

Re: Your hex editor should color-code bytes

#77
post #23

For anyone who regularly has to look at/analyze binary files, i highly recommend ImHex [1]. Its a hex editor built with imgui and has a lot of built in tools. Imo the best feature is the data structure editor. You can write a data type definition similar to C and it overlays it on the hexdump and parses it in a structured way while you type. It also has a node based editor. 1: https://github.com/WerWolv/ImHex

That looks super cool! Now I just need a reason to look at hex files

Re: Your hex editor should color-code bytes

#78

Earlier quoted context omitted.

Does it do color highlighting by value of hex bytes, though?

Yes. https://docs.werwolv.net/imhex#screenshots

as far as i can tell, no it does not. it only desaturates 00 in particular. the other colors you see in the screenshots come from matched formats/patterns. it does not do direct coloring based on byte value.

Re: Your hex editor should color-code bytes

#79
> compare that to one with colors:

The colors make it worse as I'm red-green colorblind. Looking at that mess is eye strain.

Honestly I mostly prefer syntax highlighting turned off as it causes eye strain. I have found the black on light yellow theme of the Acme editor to be a very comfortable monochrome color scheme.

Re: Your hex editor should color-code bytes

#80
post #48

Everything should try do some basic syntax highlighting IMO. Not too much, or it just becomes a sea of formatting that doesn't help at all. It is surprising how much difference just a little splash of colour can make if it isn't overdone. If possible, always include configuration options for the user though, so those with colour-blindness issues can tweak things to their needs, those who are just fussy can make the o…

> Everything should try do some basic syntax highlighting IMO. Interesting idea. So even syntax–highlighting natural language. Grammar highlighting, as it were. Prepositions, verbs, question marks, etc. An LLM could do it. Would it actually improve readability though? Seems likely!

> So even syntax–highlighting natural language. Grammar highlighting, as it were.

Not as fine-grained as individual items of grammar, but we essentially already do this and have for almost as long as writing has been a thing. Headings in bold, things that you want to emphasise in body text in italic or bold, hyperlinks underlined and/or in a different colour, …

Highlighting by grammar might be useful in language analysers/translators, for those of us trying to learn a second, though being able to pick from a selection of rules would be needed for it to be truly useful: sometimes I might want words agreeing with each other (subject->verb, subject->adjectives) in a colour of their own, sometimes specific word types (is abierto the past participle of abrir here, or the adjective?). Or verb tenses. You could perhaps do both tense and agreement, highlighting the stem by tense and the suffix with the same colour as the subject, and object pronouns the same colour as any relevant adjectives, but this is likely to make the colouring system too complex to be useful at a glance. On anything more than a single simple sentence something more dynamic might be better here, not highlighting anything by default but when something is hovered over have it and relevant things spring into colour appropriately, you'll only need small set of colours in that case rather than one for each subject/object in a longer paragraph with trying to match the same subject/object to a set colour consistently throughout.

Post reply on HN