1. TortoiseHg
  2. TortoiseHg
  3. thg
Issue #810 open

black on black (totally not visible) text with dark theme

tot-to
created an issue

I am using dark theme, with totally black background and white text. thg gets text color in diff section not from theme, but from the other location (hardcode?). I didn't find any option in thg, that can be change this behavior.

Comments (29)

  1. Dmitry Kolesnikov

    There I fixed this

    --- a/tortoisehg/hgqt/lexers.py
    +++ b/tortoisehg/hgqt/lexers.py
    @@ -200,6 +200,11 @@ class DiffLexerSelector(_ScriptLexerSelector):
                         lexer.setPaper(QtGui.QColor(e[18:]), i)
             font = qtlib.getfont('fontdiff').font()
             lexer.setFont(font, -1)
    +        palette = QtGui.QApplication.palette()
    +        colorGroup = QtGui.QPalette.Active
    +        colorRole = QtGui.QPalette.Text
    +        color = palette.color(colorGroup, colorRole)
    +        lexer.setColor(color, 0)
             return lexer
    
  2. Juan Monachesi

    I just want to add that is not only an issue for black themed desktops, any color different than white used as background color makes tortoisehg display unreadable output.

  3. Yuya Nishihara

    Thanks. Because the console gets correct background color, the DiffLexer would somehow change the background color.

    Can you provide the versions of libqscintilla, PyQt4, Qt4 and uname -a ?

    I'll try to reproduce it later. I don't have full KDE nor Gnome environment right now.

  4. Thomas Capricelli

    My system is gentoo, hence using pretty much the latest stable versions. Currently: Qt 4.8.4 x11-libs/qscintilla-2.9 dev-python/PyQt4-4.11.4

    uname -a : Linux berlioz 4.2.3 #208 SMP PREEMPT Sat Oct 3 19:04:19 CEST 2015 x86_64 AMD Athlon(tm) II X4 620 Processor AuthenticAMD GNU/Linux

    I'm often on IRC, nickname 'orzel' if i can help in a more 'interactive' fashion.

  5. Yuya Nishihara

    I tried the dark theme on Xfce4, but it worked fine. (and I didn't set up a VM for the full KDE stack yet.)

    • libqscintilla2-12v5 2.9.1+dfsg-3
    • libqtgui4 4.8.7+dfsg-4
    • xfce4 4.12.2
    • Xfce (Gtk) style: Xfce-dusk
    • Qt style: Gtk+ (necessary to apply the color style)

    So, I want more information about your environment. Can you provide the output of the following script?

    #!/usr/bin/env python
    
    from PyQt4.QtGui import QApplication
    from PyQt4.Qsci import QsciLexerDiff
    
    app = QApplication([])
    print 'base: %s' % QApplication.palette().base().color().name()
    print 'base QWidget: %s' % QApplication.palette('QWidget').base().color().name()
    
    lex = QsciLexerDiff()
    for i in xrange(8):
        print 'color[%d]: %s' % (i, lex.color(i).name())
        print 'paper[%d]: %s' % (i, lex.paper(i).name())
    
  6. Thomas Capricelli

    Sure, here we go :

    % python thgtest.py

    base: #232629
    base QWidget: #232629
    color[0]: #000000
    paper[0]: #232629
    color[1]: #007f00
    paper[1]: #232629
    color[2]: #7f7f00
    paper[2]: #232629
    color[3]: #7f0000
    paper[3]: #232629
    color[4]: #7f007f
    paper[4]: #232629
    color[5]: #007f7f
    paper[5]: #232629
    color[6]: #00007f
    paper[6]: #232629
    color[7]: #7f7f7f
    paper[7]: #232629
    
  7. Yuya Nishihara

    These values look good, sigh.

    Please test the following script to see if it has the same issue.

    #!/usr/bin/env python
    
    from PyQt4.QtGui import QApplication
    from PyQt4.Qsci import QsciLexerDiff, QsciScintilla
    
    app = QApplication([])
    dlg = QsciScintilla()
    lex = QsciLexerDiff()
    dlg.setLexer(lex)
    dlg.setText('-deleted\n+inserted\n context\n')
    dlg.show()
    app.exec_()
    
  8. Yuya Nishihara

    The default background color looks good, and TortoiseHg only changes the foreground colors. So what's going on?

    Can you test this?

    #!/usr/bin/env python
    
    from PyQt4.QtGui import QApplication
    from PyQt4.Qsci import QsciScintilla
    
    from mercurial import ui as uimod
    from tortoisehg.hgqt import lexers, qtlib
    
    app = QApplication([])
    dlg = QsciScintilla()
    ui = uimod.ui()
    qtlib.initfontcache(ui)
    lex = lexers.difflexer(dlg)
    dlg.setLexer(lex)
    dlg.setText('-deleted\n+inserted\n context\n')
    dlg.show()
    app.exec_()
    
  9. Yuya Nishihara

    That's what TortoiseHg currently does. Still I couldn't figure out why the background color is changed to light gray.

    Also, do you know what the leftmost light gray area is?

    left.jpg

    In file/annotate mode, there should be a block indicator, but the diff view should have nothing.

  10. Thomas Capricelli

    Testing today, it works a lot better.

    The differences wrt to my screenshot dated 2015-10-17 are:

    • tortoisehg: 3.5.2 -> 3.6.1
    • pyqt4 : 4.11.4 (both)
    • qt: 4.8.7 (both)
    • qscintilla: 2.9 -> 2.9.1
    • qscintilla-python: 2.9 -> 2.9.1

    Screenshot taken in "commit" mode:

    thg.better.png

  11. Thomas Capricelli

    ah. Sorry, I now understand what was going on. The problem is still here actually :-(

    It depends on whether the chunk is selected or not. As you can see, it's mostly ok when the chunk is selected (last screenshot), but totally unreadable when it is unselected (older screenshot, grey background).

  12. Log in to comment