Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color feature #45

Closed
wants to merge 7 commits into from
Closed

Color feature #45

wants to merge 7 commits into from

Conversation

jr-k
Copy link

@jr-k jr-k commented Jun 22, 2023

  • Add color edition for each Tree (Setup on PNG as example) - fifth argument of Tree constructor or withColor(Color.red()) method
  • Show byte range start/end in tooltip for each Tree labels
  • Show selected element in bold
Capture d’écran 2023-06-22 à 18 52 32

@rameshvarun
Copy link
Owner

rameshvarun commented Jun 26, 2023

I'm not 100% sold on this feature. Are there other tools you've seen that do this? I'd be interested in seeing how others approach this.

IMO, the biggest issue is that it makes it harder to see what's actually selected, even with bold text / darkened background. There's definitely something lost in terms of UI simplicity.

Screenshot 2023-06-25 at 10 05 26 PM

However, it does allow you to visualize the structure without having to click on each element individually. I wonder if mouse-over (#6) can help here?

Some other thoughts:

  • I think decoders should not be responsible for assigning colors. The UI layer should assign colors automatically, and it should just work with any decoder.
  • Adjacent regions should probably not have the same color. I think to do this right, we would need a graph coloring implementation. A node should not be colored the same as an adjacent sibling or a parent.

@jr-k
Copy link
Author

jr-k commented Jun 28, 2023

My example is just for demonstration purposes; using PNG chunk color like this is overkill and not something you'd typically do. Colors are useful for quickly scanning multiple payloads pasted together and for tracking changes in specific areas. While hovering your mouse focuses on one segment, colors allow you to keep track of multiple areas at a glance.

Adding color is an optional feature; you're not obligated to use .withColor on Trees. A toggle checkbox for colors is also a viable option.

I used decoders because the original code had "backgroundColor" directives set to grey. I simply replaced those with dynamic colors. BinaryView on the right isn't recursive, unlike the Tree on the left. The quickest way to add color—though not the most efficient or elegant—was to go with the approach in my pull request.

I added this feature quickly for my own use and thought it could benefit others, so I shared it. Your repo seems like a versatile tool for binary inspection rather than a fully-fledged framework. There haven't been many pull requests, so I figured why not. Of course, keeping the codebase clean is important, and that's ultimately your decision.

@jr-k jr-k closed this Jun 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants