-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add unique coloring for immediate values #19003 #24733
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
base: master
Are you sure you want to change the base?
Add unique coloring for immediate values #19003 #24733
Conversation
This commit implements unique color assignment for immediate values in disassembly output, making it easier to distinguish similar hex values. Changes: - Added config option 'scr.color.ops.unique' (default: false) - Added 'unique_colors' field to RPrint structure - Implemented hash-based color palette (10 distinct colors) - Identical values get identical colors consistently - Different values get different colors (with ~10% collision rate) Example: e scr.color.ops.unique=true Now 0x1234567890abcdef and 0x1234567890abcdee will have different colors, making it visually obvious they differ by one digit. Fixes: radareorg#19003
|
i think that's what scr.rainbow does already |
|
can you confirm or improve that option instead of adding more? also i dislike the scr.color.ops.unique |
@trufae I tested scr.rainbow:
This PR (scr.color.ops.unique):
but if you want
what's your thought on that? |
|
Agree its not exactly the same. That seems interesting too, because it feels like how scr.color works. But i think .ops is not the best name we can use here. maybe something like scr.color.imm will fit better, also we can have =3 to colorize using the same addr-to-color code from the rainbow and maybe we can do the same for asm.addr and remove the scr.rainbow? buit that will be another pr! lets finish some of yours first before opening more fronts! |
I have few concerns scr.color.imm = 0 → no immediate coloring (but what about scr.color.ops?)
scr.color.imm = 1 → basic coloring
scr.color.imm = 2 → unique coloringdon't you think it will crate ambiguity? What if what i was thinking of doing -> scr.color.ops = false → no operand coloring at all
scr.color.ops = true → basic operand coloring
─ scr.color.ops.imm = 0 → basic immediate coloring
─ scr.color.ops.imm = 1 → unique immediate coloringthis looks clearer to me, because of hierarchy obvious or simpler scr.color.ops.imm = 0 → basic coloring (default)
scr.color.ops.imm = 1 → unique coloringso whats your thought on this? |
Description
Implements unique color assignment for immediate values in disassembly output, making it easier to distinguish similar hex values like
0x1234567890abcdefvs0x1234567890abcdee.Changes
scr.color.ops.unique(default: false)unique_colorsboolean field toRPrintstructureUsage
Testing
Test 1: Without Unique Colors (Default Behavior)
r2 -qc 'e scr.color=3; e scr.color.ops=true; e scr.color.ops.unique=false; s main; pd 15' /tmp/test_colorsTest 2: With Unique Colors (New Feature)
r2 -qc 'e scr.color=3; e scr.color.ops=true; e scr.color.ops.unique=true; s main; pd 15' /tmp/test_colorsTest 3: Similar Hex Values (Main Use Case)