#74 Dark color schemes

git_head
closed
nobody
None
2015-02-01
2013-10-19
Tom Novelli
No

This isn't a problem for me, but some KXStudio users pointed out that Qtractor has some almost black-on-black text when used with the KXStudio theme (or presumably other dark themes). Specifically the current track's name, in qtractorTrackList::drawCell. Apparently you can't trust pal.midlight(). Maybe just use reverse colors for current track? i.e.

            bg = pal.windowText().color();
            fg = pal.window().color();

Or something like this to always choose a contrasting text color?

            #define oppcolor(c,n) (c.lightness()>127 ? c.darker(n) : c.lighter(n))
            bg = oppcolor(pal.midlight().color(), 150);
            fg = oppcolor(bg, 300);

That's just a start, I've barely tested it. What do you think though?

Discussion

  • Rui Nuno Capela

    Rui Nuno Capela - 2013-10-19

    there's a special palette re-configuration going on at the application level and that sure makes a difference for dark themes; see it in src/qtractor.cpp, lines 355-385.

    // Dark themes grayed/disabled color group fix...
    QPalette pal(app.palette());
    if (pal.base().color().value() < 0x7f) {
        const QColor& color = pal.window().color();
        const int iGroups = int(QPalette::Active | QPalette::Inactive) + 1;
        for (int i = 0; i < iGroups; ++i) {
            const QPalette::ColorGroup group = QPalette::ColorGroup(i);
            pal.setBrush(group, QPalette::Light,    color.lighter(140));
            pal.setBrush(group, QPalette::Midlight, color.lighter(100));
            pal.setBrush(group, QPalette::Mid,      color.lighter(90));
            pal.setBrush(group, QPalette::Dark,     color.darker(160));
            pal.setBrush(group, QPalette::Shadow,   color.darker(180));
        }
        pal.setColorGroup(QPalette::Disabled,
            pal.windowText().color().darker(),
            pal.button(),
            pal.light(),
            pal.dark(),
            pal.mid(),
            pal.text().color().darker(),
            pal.text().color().lighter(),
            pal.base(),
            pal.window());
    #if QT_VERSION >= 0x050000
        pal.setColor(QPalette::Disabled,
            QPalette::Highlight, pal.mid().color());
        pal.setColor(QPalette::Disabled,
            QPalette::ButtonText, pal.mid().color());
    #endif
        app.setPalette(pal);
    }
    

    i myself do use a dark color theme, "Wonton Soup" from stock KDE4, and did tests with other darker themes; problem on KXSTudio default color scheme is not that dark, it's black :) so that pal.window.color() gives you pitch black (#000000) and then, QPalette::Dark and QPalette::Shadow groups will render into the same--nothing can be made darker than black :)

    cheers

     
  • Tom Novelli

    Tom Novelli - 2013-10-19

    Oh I see, my proposal would be a kludge on top of a kludge. Still, a black background is totally legit. We gotta do something about this darker-than-black problem... gotta go lighter, not darker, in that case. When, exactly? Probably when the theme designer chose an inverse color scheme: pal.base().lightness() < pal.text().lightness().

    New proposal: create a custom palette structure instead of using QPalette. All your color lightening/darkening/etc should be in the palette-creation function, so functions like qtractorTrackList::drawCell can just say bg=pal.currentTrackBG; fg=pal.currentTrackFG; or whatever. Also, you can hook app::changeEvent to do this whenever the system palette changes, so users don't have to restart Qtractor after tweaking their theme :)

    I'm going to try this custom palette idea in my app (my first Qt app btw :) so you might want to wait and see how it works out.

     
  • Tom Novelli

    Tom Novelli - 2013-10-21

    Hey, here's a patch to re-run your palette reconfiguration when the system palette changes (which should be handy for testing Qtractor while changing color schemes in qtconfig or KDE settings).

    HOWEVER, track headers still don't change color (until I click on them, just like before). There's something I don't understand. Can you figure it out? :)

     
    • Rui Nuno Capela

      Rui Nuno Capela - 2013-10-22

      re.track headers still don't change color...
      the following might be more appropriate than viewRefresh(), updateTrackview() or updateTrackList() (which updates the current highlighted track only) ?

      m_pTracks->trackTime()->repaint();
      m_pTracks->trackList()->repaint();
      m_pTracks->trackView()->repaint();
      

      hth.
      cheers

       
  • Tom Novelli

    Tom Novelli - 2013-10-30

    Well, that didn't work... I tried a few other things and gave up. For the record here's another patch with everything I tried.

     
  • Rui Nuno Capela

    Rui Nuno Capela - 2013-11-11

    today i've made some tweks on colors, esp. on the track-list highlight track and MIDI editor piano-keys front.

    see if you like it. (svn trunk [r3604] qtractor v0.5.11.22)

    hth.
    cheers

     

    Related

    Commit: <Commit 5181bb35a02bb134b2580972:3604>

  • Rui Nuno Capela

    Rui Nuno Capela - 2013-11-26
    • status: open --> pending
     
  • Rui Nuno Capela

    Rui Nuno Capela - 2013-12-11
    • status: pending --> closed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks