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

Issue #810 open
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 (43)

  1. Dmitry Kolesnikov

    There I fixed this

    --- a/tortoisehg/hgqt/
    +++ b/tortoisehg/hgqt/
    @@ -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

    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

    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.setText('-deleted\n+inserted\n context\n')
  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()
    lex = lexers.difflexer(dlg)
    dlg.setText('-deleted\n+inserted\n context\n')
  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?


    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:


  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. Arthur Blake

    Using TortoiseHg 4.0.2 with a high contract (black background) theme on Windows - it's mostly OK, but some things are quite bad. The two main challenges are the branch colors (in particular, a dark blue and dark purple that are incredibly hard to read on a black background that the UI seems to use often) and the message for commit (has a black foreground which is unreadable on the black background except for the current line the cursor is on which is highlighted with a white background.) Is there anything I can do to adjust the colors?

  13. Thomas Khyn

    @Arthur Blake for the dark blue and dark purple, you may want to edit your mercurial.ini file

    I use this:

    status.modified = cyan

    And you may want to change the following (possibly status.unknown for the purple?):

    # [thg-color]
    # status.modified = blue bold underline red_background
    # status.added = green bold
    # status.removed = red bold blue_background
    # status.deleted = cyan bold underline
    # status.unknown = magenta bold underline
    # status.ignored = black bold
    # # 'none' turns off all effects
    # status.clean = none
    # status.copied = none
    # qseries.applied = blue bold underline
    # qseries.unapplied = black bold
    # qseries.missing = red bold
    # diff.diffline = bold
    # diff.extended = cyan bold
    # diff.file_a = red bold
    # diff.file_b = green bold
    # diff.hunk = magenta
    # diff.deleted = red
    # diff.inserted = green
    # diff.changed = white
    # =
    # diff.trailingwhitespace = bold red_background
    # # Blank so it inherits the style of the surrounding label
    # changeset.public =
    # changeset.draft =
    # changeset.secret =
    # resolve.unresolved = red bold
    # resolve.resolved = green bold
    # = green
    # = none
    # branches.closed = black bold
    # branches.current = green
    # branches.inactive = none
    # tags.normal = green
    # tags.local = black bold
    # rebase.rebased = blue
    # rebase.remaining = red bold
    # shelve.age = cyan
    # shelve.newest = green bold
    # = blue bold
    # histedit.remaining = red bold
    # Custom colors
    # -------------
    # Because there are only eight standard colors, this module allows you
    # to define color names for other color slots which might be available
    # for your terminal type, assuming terminfo mode.  For instance::
    #   color.brightblue = 12
    # = 207
    # = 202
    # to set 'brightblue' to color slot 12 (useful for 16 color terminals
    # that have brighter colors defined in the upper eight) and, 'pink' and
    # 'orange' to colors in 256-color xterm's default color cube.  These
    # defined colors may then be used as any of the pre-defined eight,
    # including appending '_background' to set the background to that color.

    Regarding the commit message, I have no problem using the Placebo Ashtray theme (which I recommend if you want a dark Windows), the text is shown in white on dark.

  14. Arthur Blake

    Thanks, although the color settings you've shown here in mercurial.ini do not seem to have any effect whatsoever (after restarting of course.) Are those documented anywhere? (by the way, I can't currently connect to - seems to be getting some kind of HSTS cerificate error.

    I don't want to change my windows color theme now as I spent a lot of effort getting things to look good with a lot of other apps in the current theme I'm using (High Contract Black that comes with windows.) Seems like many apps don't work so well with dark themes without lots and lots of tweaking.

  15. Thomas Khyn

    I found that in an old mailing list thread if I remember correctly and did a quick copy-paste-comment to keep trace of it. If I find it I'll publish the link.

    The color status.modified only changes the font color in the modified files overview area from dark blue (barely visible with a dark background) to cyan. As far as I know there is no way to change the default branch colors in the commit tree area through the config file.

    (offtopic)I too spent a lot of time trying to find a correct dark theme for Windows, and Placebo Ashtray worked really well with almost no tweaking(/offtopic)

  16. Pavol Lisy

    This worked:

    status.modified = cyan
    # status.modified = #FFFF00   # this is working too!

    But how to change color for commit message please?

    + console background
    + log viewer annotate background

    (or please public list of all possibilities usable in thg-color section!)

  17. qwerty987321

    +1, Using the console and hg file log viewer is especially difficult. Both of these interfaces still use light gray background.

    Otherwise, diff colors work nicely (tested on Win7 dark high constrast theme).

  18. Arthur Blake

    There is however, a serious issue with the install dialogs. The background images used assume that the font used is a dark font, making it unreadable on a windows dark theme. Example:sample.png

  19. Arthur Blake

    After using it for a little bit, I realized there is another problem.
    The checkin comments box is unreadable (shows as black on black), except for the current line the cursor is on which is highlighted so is readable.
    This makes it very hard to use with a high contrast theme on windows.

  20. Nicolas Piguet

    It's working quite nicely now, there is just a few places where the dark theme case is forgotten. One of them is the console window:


    Another one is the set of default branch colors:


    I know I can override branch colors manually, but this is a project on which a lot of people are working, and there are new branches all time, so it is very tedious to set their color to something readable one by one

    The last one that bothers me (but that one is really small), is the line number in the diff view. For some reason, the revision numbers are white-on-black but the line numbers are black-on-white (but at least they are readable):


  21. Log in to comment