diaphora icon indicating copy to clipboard operation
diaphora copied to clipboard

Darker colors for Graph assembly diff and Pseudo-code diff views

Open MoebiuZ opened this issue 9 years ago • 12 comments

Hi Joxean.

I use a solarized theme for IDA (specifically I use IDASkins plugin plus Consonance color scheme).

Colors for Added, Changed and Deleted are too bright, and that makes difficult to read the highlighted white/light grey text (I use a very high res btw, and my text is very tiny, so in part is my fault :P).

Darkening these colors probably fix the "issue" with solarized skins, without the need to add themes to diaphora.

Cheers

MoebiuZ avatar Apr 18 '15 01:04 MoebiuZ

I think that in the case that the background is not 'white' colour I will just disable it. Because otherwise it would require to adjust the colours for each theme.

joxeankoret avatar Apr 20 '15 07:04 joxeankoret

BTW, do you know if there is any (documented, if possible) way to determine if that plugin is loaded? I have some ideas, but all of them are hacks.

joxeankoret avatar Apr 21 '15 14:04 joxeankoret

This is such a hack too, but it works while they don't change the _styles variable behaviour in difflib.

Add this under imports in diaphora.py

HtmlDiff._styles = """ table.diff {font-family:Courier; border:medium; background-color:#ffffff; color:#000000} .diff_header {background-color:#e0e0e0} td.diff_header {text-align:right} .diff_next {background-color:#c0c0c0} .diff_add {background-color:#aaffaa} .diff_chg {background-color:#ffff77} .diff_sub {background-color:#ffaaaa}"""

MoebiuZ avatar Apr 21 '15 15:04 MoebiuZ

Thanks for the patch! Applied with commit 314f0f27905970bd9470c975a317338f16aaa3d3

joxeankoret avatar Apr 21 '15 15:04 joxeankoret

Seems like this problem might be back:

image

zx2c4 avatar May 05 '20 03:05 zx2c4

This problem is due to syntax highlighting and themes (introduced with e83507ea9a16e2e000acafa2ea6ccd3cfb0a5e2b). I will take a look.

joxeankoret avatar May 05 '20 07:05 joxeankoret

What are you using for the themes? IDA Skins, maybe?

joxeankoret avatar May 05 '20 07:05 joxeankoret

I got this from somewhere a long time ago.

zx2c4@thinkpad ~/.idapro/themes/default $ cat user.css 
/* NOTE: This is an autogenerated file; please do not edit. */

CustomIDAMemo
{
    qproperty-line-fg-default: #AAAAAA;
    qproperty-line-fg-regular-comment: #FFC5F3;
    qproperty-line-fg-repeatable-comment: #82607E;
    qproperty-line-fg-automatic-comment: #AEAEAE;
    qproperty-line-fg-insn: white;
    qproperty-line-fg-dummy-data-name: #EBEBB9;
    qproperty-line-fg-regular-data-name: #EBEBB9;
    qproperty-line-fg-demangled-name: #FFECBB;
    qproperty-line-fg-punctuation: silver;
    qproperty-line-fg-charlit-in-insn: #69D200;
    qproperty-line-fg-numlit-in-insn: #D25032;
    qproperty-line-fg-void-opnd: #FF4646;
    qproperty-line-fg-code-xref: #FFAA7F;
    qproperty-line-fg-data-xref: #7C7C61;
    qproperty-line-fg-code-xref-to-tail: #D25032;
    qproperty-line-fg-error: #FF3437;
    qproperty-line-fg-opcode-byte: #A0A0A0;
    qproperty-line-fg-extra-line: #FFC5F3;
    qproperty-line-fg-alt-opnd: #FFAAFF;
    qproperty-line-fg-hidden: #FFD200;
    qproperty-line-fg-libfunc: aqua;
    qproperty-line-fg-locvar: #FF8000;
    qproperty-line-fg-dummy-code-name: #FFD200;
    qproperty-line-fg-asm-directive: #9DD600;
    qproperty-line-fg-macro: #DF077E;
    qproperty-line-fg-strlit-in-data: #69D200;
    qproperty-line-fg-charlit-in-data: #79F300;
    qproperty-line-fg-numlit-in-data: #D25032;
    qproperty-line-fg-keyword: #ABABAB;
    qproperty-line-fg-register-name: #73ADAD;
    qproperty-line-fg-import-name: #FF5AFD;
    qproperty-line-fg-segment-name: #FFFF7F;
    qproperty-line-fg-dummy-unknown-name: #AAFF00;
    qproperty-line-fg-code-name: #FFD200;
    qproperty-line-fg-unknown-name: #FFAAFF;
    qproperty-line-fg-collapsed-line: yellow;
    qproperty-line-bg-default: #313131;
    qproperty-line-bg-selected: #E1AD32;
    qproperty-line-pfx-func: #666666;
    qproperty-line-pfx-insn: #AA0000;
    qproperty-line-pfx-data: #7C7C61;
    qproperty-line-pfx-unexplored: #9D9D00;
    qproperty-line-pfx-extern: #FF55FF;
    qproperty-line-pfx-current-line: #FFAA00;
    qproperty-graph-bg-top: #B2B2B2;
    qproperty-graph-node-title-selected: #DDFFFF;
}

CustomIDAMemo[debugging="true"]
{
    qproperty-line-fg-default: #AAAAAA;
    qproperty-line-fg-regular-comment: #FFC5F3;
    qproperty-line-fg-repeatable-comment: #82607E;
    qproperty-line-fg-automatic-comment: #AEAEAE;
    qproperty-line-fg-insn: white;
    qproperty-line-fg-dummy-data-name: #EBEBB9;
    qproperty-line-fg-regular-data-name: #EBEBB9;
    qproperty-line-fg-demangled-name: #FFECBB;
    qproperty-line-fg-punctuation: silver;
    qproperty-line-fg-charlit-in-insn: #69D200;
    qproperty-line-fg-numlit-in-insn: #D25032;
    qproperty-line-fg-void-opnd: #FF4646;
    qproperty-line-fg-code-xref: #FFAA7F;
    qproperty-line-fg-data-xref: #7C7C61;
    qproperty-line-fg-code-xref-to-tail: #D25032;
    qproperty-line-fg-error: #FF3437;
    qproperty-line-fg-opcode-byte: #A0A0A0;
    qproperty-line-fg-extra-line: #FFC5F3;
    qproperty-line-fg-alt-opnd: #FFAAFF;
    qproperty-line-fg-hidden: #FFD200;
    qproperty-line-fg-libfunc: aqua;
    qproperty-line-fg-locvar: #FF8000;
    qproperty-line-fg-dummy-code-name: #FFD200;
    qproperty-line-fg-asm-directive: #9DD600;
    qproperty-line-fg-macro: #DF077E;
    qproperty-line-fg-strlit-in-data: #69D200;
    qproperty-line-fg-charlit-in-data: #79F300;
    qproperty-line-fg-numlit-in-data: #D25032;
    qproperty-line-fg-keyword: #ABABAB;
    qproperty-line-fg-register-name: #73ADAD;
    qproperty-line-fg-import-name: #FF5AFD;
    qproperty-line-fg-segment-name: #FFFF7F;
    qproperty-line-fg-dummy-unknown-name: #AAFF00;
    qproperty-line-fg-code-name: #FFD200;
    qproperty-line-fg-unknown-name: #FFAAFF;
    qproperty-line-fg-collapsed-line: yellow;
    qproperty-line-bg-default: #435454;
    qproperty-line-bg-selected: #E1AD32;
    qproperty-line-pfx-func: #666666;
    qproperty-line-pfx-insn: #AA0000;
    qproperty-line-pfx-data: #7C7C61;
    qproperty-line-pfx-unexplored: #9D9D00;
    qproperty-line-pfx-extern: #FF55FF;
    qproperty-line-pfx-current-line: #FFAA00;
    qproperty-graph-bg-top: #B2B2B2;
    qproperty-graph-node-title-selected: #DDFFFF;
}

CustomIDAMemo[hints="true"]
{
    qproperty-line-fg-default: #AAAAAA;
    qproperty-line-fg-regular-comment: #FFC5F3;
    qproperty-line-fg-repeatable-comment: #82607E;
    qproperty-line-fg-automatic-comment: #AEAEAE;
    qproperty-line-fg-insn: white;
    qproperty-line-fg-dummy-data-name: #EBEBB9;
    qproperty-line-fg-regular-data-name: #EBEBB9;
    qproperty-line-fg-demangled-name: #FFECBB;
    qproperty-line-fg-punctuation: silver;
    qproperty-line-fg-charlit-in-insn: #69D200;
    qproperty-line-fg-numlit-in-insn: #D25032;
    qproperty-line-fg-void-opnd: #FF4646;
    qproperty-line-fg-code-xref: #FFAA7F;
    qproperty-line-fg-data-xref: #7C7C61;
    qproperty-line-fg-code-xref-to-tail: #D25032;
    qproperty-line-fg-error: #FF3437;
    qproperty-line-fg-opcode-byte: #A0A0A0;
    qproperty-line-fg-extra-line: #FFC5F3;
    qproperty-line-fg-alt-opnd: #FFAAFF;
    qproperty-line-fg-hidden: #FFD200;
    qproperty-line-fg-libfunc: aqua;
    qproperty-line-fg-locvar: #FF8000;
    qproperty-line-fg-dummy-code-name: #FFD200;
    qproperty-line-fg-asm-directive: #9DD600;
    qproperty-line-fg-macro: #DF077E;
    qproperty-line-fg-strlit-in-data: #69D200;
    qproperty-line-fg-charlit-in-data: #79F300;
    qproperty-line-fg-numlit-in-data: #D25032;
    qproperty-line-fg-keyword: #ABABAB;
    qproperty-line-fg-register-name: #73ADAD;
    qproperty-line-fg-import-name: #FF5AFD;
    qproperty-line-fg-segment-name: #FFFF7F;
    qproperty-line-fg-dummy-unknown-name: #AAFF00;
    qproperty-line-fg-code-name: #FFD200;
    qproperty-line-fg-unknown-name: #FFAAFF;
    qproperty-line-fg-collapsed-line: yellow;
    qproperty-line-bg-selected: #E1AD32;
    qproperty-line-pfx-func: #666666;
    qproperty-line-pfx-insn: #AA0000;
    qproperty-line-pfx-data: #7C7C61;
    qproperty-line-pfx-unexplored: #9D9D00;
    qproperty-line-pfx-extern: #FF55FF;
    qproperty-line-pfx-current-line: #FFAA00;
    qproperty-graph-bg-top: #B2B2B2;
    qproperty-graph-node-title-selected: #DDFFFF;
}

navband_t
{
    qproperty-lib-function: #00AAFF;
}

TextArrows
{
    qproperty-jump-in-function: #6C4634;
}

MainMsgList
{
    color: #212121;
}

zx2c4 avatar May 05 '20 08:05 zx2c4

I don't know what to do in this case. If you were using a plugin I could try to detect the plugin and see what is it using to try to, perhaps, accomodate colours somehow. But in this case... I'm at lost.

Help to fix this "bug" would be appreciated.

joxeankoret avatar May 05 '20 09:05 joxeankoret

The color theme change setting function have been integrated in IDA (probably since IDA 7.3?). You can test the dark color theme by clicking Options -> Colors -> Current theme.

I have the same issue in my dark theme colors. It's difficult to read the variable names in diaphora. Screen Shot 2021-06-18 at 12 40 18

I would appreciate if you add the dark mode option in this tool like lighthouse.

TakahiroHaruyama avatar Jun 18 '21 03:06 TakahiroHaruyama

I will take a look to Lighthouse to see how they did it.

joxeankoret avatar Jun 19 '21 10:06 joxeankoret

cool thanks!

TakahiroHaruyama avatar Jun 19 '21 14:06 TakahiroHaruyama

Just for clarity (and to track this issue), any progress on this? It's still an issue with 2.0.6 and IDA 7.7.

EDIT: Seems like Lighthouse literally takes a screenshot of the disassembly view to sample the background color, but even then it doesn't help much when it comes to applying dark mode on diffs. I was able to fix "Unmatched functions" having a white background by changing the last return value of OnGetLineAttr, but that doesn't get me any closer to dark mode diffing.

CookiePLMonster avatar Oct 10 '22 16:10 CookiePLMonster

I haven't really done any work on this, to be honest. Probably not doing anything with colors at all when Diaphora is able to detect that the reverser is using a dark theme could work. Other than that, really, I don't know what to do. If anyone has any suggestion (or better yet a patch) I would be thankful.

joxeankoret avatar Oct 13 '22 07:10 joxeankoret

This is fixed in Diaphora 3.0, to be released soon. It's handled with the newly added diaphora_config.py, and it allows modifying the diff colors as well as the call graph nodes colours. If you want to try to beta, tell me and I will send you it.

joxeankoret avatar Apr 10 '23 17:04 joxeankoret