Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-96354

Incorrect lightness calculation in QCommonStyle



    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.15.2
    • Fix Version/s: None
    • Labels:
    • Environment:


      In KeePassXC (Version 2.6.6) an "inner" background color is derived from the background color by making it lighter. This works fine with darker and darker background colors, until a breakpoint is reached, when the derived color all of a sudden becomes much lighter, which often causes text to be difficult to read due to low contrast.

      For example, I made themes with green backgrounds (and not green in any other area to make sure it was the correct color that was derived from) and got the following results:

      1. From the background: #001f00, the inner background color #004200 is derived.
      2. From the background: #001e00, the inner background color #004100 is derived, see the attachment keepass_good.png.
      3. From the background: #001d00, the inner background color #00cc00 is derived, which is very bright, see the attachment keepass_bad.png. To follow the pattern the expected color is #004000.

      I first thought it was an KeePassXC issue and reported it there. According to the developers this is a bug in Qt, most likely in the QCommonStyle class. Unfortunately, I am not familiar with that code base, nor C++ or Qt, so I can not provide a more exact location of the use of QCommonStyle other than it seem to be included in the header BaseStyle.h with the corresponding source file BaseStyle.cpp.

      KeePassXC has two built in themes (light and dark), but this concerns the use of the system theme, i.e., View -> Theme -> Classic (Platform-native).

      For the themes I used the default "Qt Widget engine" in KDE Plasma called Breeze (under GNU+Linux).


        1. keepass_bad.png
          15 kB
        2. keepass_good.png
          15 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            qt.team.quick.subscriptions Qt Quick and Widgets Team
            klorax K X
            0 Vote for this issue
            2 Start watching this issue



                Gerrit Reviews

                There are no open Gerrit changes