tweaked the light themes

This commit is contained in:
fourtf 2017-12-26 16:54:39 +01:00
parent 37ca3cd79e
commit 4e4cc9223e
4 changed files with 40 additions and 19 deletions

View file

@ -57,6 +57,8 @@ void ColorScheme::setColors(double hue, double multiplier)
{
lightTheme = multiplier > 0;
qreal sat = 0.05;
SystemMessageColor = QColor(140, 127, 127);
auto getColor = [multiplier](double h, double s, double l, double a = 1.0) {
@ -97,19 +99,21 @@ void ColorScheme::setColors(double hue, double multiplier)
TabNewMessageBackground = QBrush(QColor::fromHslF(hue, 0.5, 0.8), Qt::DiagCrossPattern);
// Chat
ChatBackground = getColor(0, 0.1, 1);
bool flat = lightTheme;
ChatBackground = getColor(0, sat, 1);
ChatBackgroundHighlighted = blendColors(TabSelectedBackground, ChatBackground, 0.8);
ChatHeaderBackground = getColor(0, 0.1, 0.9);
ChatHeaderBorder = getColor(0, 0.1, 0.85);
ChatInputBackground = getColor(0, 0.1, 0.95);
ChatInputBorder = getColor(0, 0.1, 0.9);
ChatHeaderBackground = getColor(0, sat, flat ? 1 : 0.9);
ChatHeaderBorder = getColor(0, sat, flat ? 1 : 0.85);
ChatInputBackground = getColor(0, sat, flat ? 0.95 : 0.95);
ChatInputBorder = getColor(0, sat, flat ? 1 : 1);
ChatSeperator = lightTheme ? QColor(127, 127, 127) : QColor(80, 80, 80);
// Scrollbar
ScrollbarBG = ChatBackground;
ScrollbarThumb = getColor(0, 0.1, 0.85);
ScrollbarThumbSelected = getColor(0, 0.1, 0.7);
ScrollbarArrow = getColor(0, 0.1, 0.9);
ScrollbarBG = getColor(0, sat, 0.90);
ScrollbarThumb = getColor(0, sat, 0.80);
ScrollbarThumbSelected = getColor(0, sat, 0.7);
ScrollbarArrow = getColor(0, sat, 0.9);
// stylesheet
InputStyleSheet = "background:" + ChatInputBackground.name() + ";" +

View file

@ -22,7 +22,7 @@ SplitInput::SplitInput(Split *_chatWidget)
this->setLayout(&this->hbox);
this->hbox.setMargin(0);
this->hbox.setMargin(4);
this->hbox.addLayout(&this->editContainer);
this->hbox.addLayout(&this->vbox);
@ -37,7 +37,7 @@ SplitInput::SplitInput(Split *_chatWidget)
}));
this->editContainer.addWidget(&this->textInput);
this->editContainer.setMargin(4);
this->editContainer.setMargin(2);
this->emotesLabel.setMinimumHeight(24);
@ -215,6 +215,8 @@ void SplitInput::refreshTheme()
this->textLengthLabel.setPalette(palette);
this->textInput.setStyleSheet(this->colorScheme.InputStyleSheet);
this->hbox.setMargin((this->colorScheme.isLightTheme() ? 4 : 2) * this->getDpiMultiplier());
}
void SplitInput::editTextChanged()
@ -243,7 +245,12 @@ void SplitInput::paintEvent(QPaintEvent *)
QPainter painter(this);
painter.fillRect(this->rect(), this->colorScheme.ChatInputBackground);
painter.setPen(this->colorScheme.ChatInputBorder);
QPen pen(this->colorScheme.ChatInputBorder);
if (this->colorScheme.isLightTheme()) {
pen.setWidth((int)(6 * this->getDpiMultiplier()));
}
painter.setPen(pen);
painter.drawRect(0, 0, this->width() - 1, this->height() - 1);
}
@ -254,6 +261,8 @@ void SplitInput::resizeEvent(QResizeEvent *)
} else {
this->textInput.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}
this->refreshTheme();
}
void SplitInput::mousePressEvent(QMouseEvent *)

View file

@ -244,6 +244,11 @@ void ScrollBar::paintEvent(QPaintEvent *)
this->mutex.unlock();
}
void ScrollBar::resizeEvent(QResizeEvent *)
{
this->resize((int)(16 * this->getDpiMultiplier()), this->height());
}
void ScrollBar::mouseMoveEvent(QMouseEvent *event)
{
if (this->mouseDownIndex == -1) {

View file

@ -52,6 +52,14 @@ public:
void printCurrentState(const QString &prefix = QString()) const;
protected:
void paintEvent(QPaintEvent *) override;
void resizeEvent(QResizeEvent *) override;
void mouseMoveEvent(QMouseEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
void leaveEvent(QEvent *) override;
private:
Q_PROPERTY(qreal currentValue READ getCurrentValue WRITE setCurrentValue)
@ -61,19 +69,14 @@ private:
ScrollBarHighlight *highlights;
void paintEvent(QPaintEvent *);
void mouseMoveEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void leaveEvent(QEvent *);
bool atBottom = false;
int mouseOverIndex = -1;
int mouseDownIndex = -1;
QPoint lastMousePosition;
int buttonHeight = 16;
// int buttonHeight = 16;
int buttonHeight = 0;
int trackHeight = 100;
QRect thumbRect;