Styled background color of QScrollBar is tinted white
-
With Qt 6.4.2, Windows 10, and a stylesheet applied to
QScrollBar
, I'm having trouble setting the background color of the scroll bar. Whatever color I set always seems to have a white tint applied to it.For example, when I set the background color to black, the actual color is a light gray:
When I set it to red, the actual color is a light pink.
Furthermore, I noticed that when I take a screenshot, the color in the screenshot is sometimes correct and doesn't match what I actually saw on the screen. I have no idea why, and it makes it hard to share good screenshots in this post (screenshots of my red one show actual pure red even though it's light pink on the screen).
What is going on?
Here is my full stylesheet (which is being set on
qApp
), just in case it's a matter of something else in the stylesheet affecting the scrollbar:* { background: rgb(23, 29, 40); color: rgb(112, 123, 148); } QPushButton { background: rgb(38, 46, 60); color: rgb(161, 170, 190); border-radius: 4px; padding: 0.5ex 2ex; font-weight: bold; } QPushButton::hover { background: rgb(85, 95, 112); color: rgb(255, 255, 255); } QPushButton::pressed { background: rgb(255, 217, 122); color: rgb(19, 24, 32); } QPlainTextEdit, QLineEdit { background: rgb(33, 40, 51); color: rgb(139, 149, 161); border: none; padding: 1ex; } QScrollBar { width: 4px; background: red; /*rgb(42, 53, 65);*/ } QScrollBar::handle { border: none; background: rgb(85, 95, 112); }
-
With Qt 6.4.2, Windows 10, and a stylesheet applied to
QScrollBar
, I'm having trouble setting the background color of the scroll bar. Whatever color I set always seems to have a white tint applied to it.For example, when I set the background color to black, the actual color is a light gray:
When I set it to red, the actual color is a light pink.
Furthermore, I noticed that when I take a screenshot, the color in the screenshot is sometimes correct and doesn't match what I actually saw on the screen. I have no idea why, and it makes it hard to share good screenshots in this post (screenshots of my red one show actual pure red even though it's light pink on the screen).
What is going on?
Here is my full stylesheet (which is being set on
qApp
), just in case it's a matter of something else in the stylesheet affecting the scrollbar:* { background: rgb(23, 29, 40); color: rgb(112, 123, 148); } QPushButton { background: rgb(38, 46, 60); color: rgb(161, 170, 190); border-radius: 4px; padding: 0.5ex 2ex; font-weight: bold; } QPushButton::hover { background: rgb(85, 95, 112); color: rgb(255, 255, 255); } QPushButton::pressed { background: rgb(255, 217, 122); color: rgb(19, 24, 32); } QPlainTextEdit, QLineEdit { background: rgb(33, 40, 51); color: rgb(139, 149, 161); border: none; padding: 1ex; } QScrollBar { width: 4px; background: red; /*rgb(42, 53, 65);*/ } QScrollBar::handle { border: none; background: rgb(85, 95, 112); }
-