diff --git a/src/TerminalDisplay.h b/src/TerminalDisplay.h --- a/src/TerminalDisplay.h +++ b/src/TerminalDisplay.h @@ -757,6 +757,8 @@ void inputMethodEvent(QInputMethodEvent *event) Q_DECL_OVERRIDE; QVariant inputMethodQuery(Qt::InputMethodQuery query) const Q_DECL_OVERRIDE; + void updateScrollBarPalette(); + protected Q_SLOTS: void scrollBarPositionChanged(int value); diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp --- a/src/TerminalDisplay.cpp +++ b/src/TerminalDisplay.cpp @@ -131,17 +131,35 @@ { return _colorTable; } + +void TerminalDisplay::updateScrollBarPalette() +{ + QColor backgroundColor = _colorTable[DEFAULT_BACK_COLOR]; + backgroundColor.setAlphaF(_opacity); + QPalette p = palette(); + p.setColor(QPalette::Window, backgroundColor); + + //this is a workaround to add some readability to old themes like Fusion + //changing the light value for button a bit makes themes like fusion, windows and oxygen way more readable and pleasing + QColor buttonColor; + buttonColor.setHsvF(backgroundColor.hueF(), backgroundColor.saturationF(), backgroundColor.valueF() + (backgroundColor.valueF() < 0.5 ? 0.2 : -0.2)); + p.setColor(QPalette::Button, buttonColor); + + p.setColor(QPalette::WindowText, _colorTable[DEFAULT_FORE_COLOR]); + p.setColor(QPalette::ButtonText, _colorTable[DEFAULT_FORE_COLOR]); + _scrollBar->setPalette(p); + +} + void TerminalDisplay::setBackgroundColor(const QColor& color) { _colorTable[DEFAULT_BACK_COLOR] = color; QPalette p = palette(); p.setColor(backgroundRole(), color); setPalette(p); - // Avoid propagating the palette change to the scroll bar - _scrollBar->setPalette(QApplication::palette()); - + updateScrollBarPalette(); update(); } QColor TerminalDisplay::getBackgroundColor() const @@ -153,6 +171,7 @@ { _colorTable[DEFAULT_FORE_COLOR] = color; + updateScrollBarPalette(); update(); } void TerminalDisplay::setColorTable(const ColorEntry table[]) @@ -399,6 +418,7 @@ // create scroll bar for scrolling output up and down _scrollBar = new QScrollBar(this); + _scrollBar->setAutoFillBackground(false); // set the scroll bar's slider to occupy the whole area of the scroll bar initially setScroll(0, 0); _scrollBar->setCursor(Qt::ArrowCursor); @@ -755,6 +775,7 @@ }*/ _blendColor = color.rgba(); + updateScrollBarPalette(); } void TerminalDisplay::setWallpaper(ColorSchemeWallpaper::Ptr p)