Commit 2a71f063 authored by Marco Martin's avatar Marco Martin Committed by Kurt Hindenburg

use the terminal color scheme for the scrollbar

As discussed with VDG, color the scrollbar with the same colors as
the terminal color scheme itself. It looks way cleaner and modern

Test Plan: tested with several color schemes and several styles

Reviewers: #konsole, #vdg, hindenburg

Reviewed By: #konsole, #vdg, hindenburg

Subscribers: hindenburg, zzag, ngraham

Tags: #konsole

Differential Revision:
parent b85c469e
......@@ -131,6 +131,26 @@ const ColorEntry* TerminalDisplay::colorTable() const
return _colorTable;
void TerminalDisplay::updateScrollBarPalette()
QColor backgroundColor = _colorTable[DEFAULT_BACK_COLOR];
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]);
void TerminalDisplay::setBackgroundColor(const QColor& color)
_colorTable[DEFAULT_BACK_COLOR] = color;
......@@ -139,9 +159,7 @@ void TerminalDisplay::setBackgroundColor(const QColor& color)
p.setColor(backgroundRole(), color);
// Avoid propagating the palette change to the scroll bar
QColor TerminalDisplay::getBackgroundColor() const
......@@ -153,6 +171,7 @@ void TerminalDisplay::setForegroundColor(const QColor& color)
_colorTable[DEFAULT_FORE_COLOR] = color;
void TerminalDisplay::setColorTable(const ColorEntry table[])
......@@ -399,6 +418,7 @@ TerminalDisplay::TerminalDisplay(QWidget* parent)
// create scroll bar for scrolling output up and down
_scrollBar = new QScrollBar(this);
// set the scroll bar's slider to occupy the whole area of the scroll bar initially
setScroll(0, 0);
......@@ -755,6 +775,7 @@ void TerminalDisplay::setOpacity(qreal opacity)
_blendColor = color.rgba();
void TerminalDisplay::setWallpaper(ColorSchemeWallpaper::Ptr p)
......@@ -757,6 +757,8 @@ protected:
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);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment