changes for light theme

- fixed light colored text being too bright
- fixed the ripple effect being white on grey
This commit is contained in:
fourtf
2017-12-19 02:23:17 +01:00
parent 1a870685b0
commit f8e4d9a737
4 changed files with 26 additions and 7 deletions
+11 -2
View File
@@ -132,7 +132,16 @@ QColor ColorScheme::blendColors(const QColor &color1, const QColor &color2, qrea
void ColorScheme::normalizeColor(QColor &color)
{
if (this->lightTheme) {
// TODO: write some codes
if (color.lightnessF() > 0.5f) {
color.setHslF(color.hueF(), color.saturationF(), 0.5f);
}
if (color.lightnessF() > 0.4f && color.hueF() > 0.1 && color.hueF() < 0.33333) {
color.setHslF(color.hueF(), color.saturationF(),
color.lightnessF() -
sin((color.hueF() - 0.1) / (0.3333 - 0.1) * 3.14159) *
color.saturationF() * 0.2);
}
} else {
if (color.lightnessF() < 0.5f) {
color.setHslF(color.hueF(), color.saturationF(), 0.5f);
@@ -142,7 +151,7 @@ void ColorScheme::normalizeColor(QColor &color)
color.setHslF(color.hueF(), color.saturationF(),
color.lightnessF() +
sin((color.hueF() - 0.54444) / (0.8333 - 0.54444) * 3.14159) *
color.saturationF() * 0.2);
color.saturationF() * 0.4);
}
}
}
+10 -2
View File
@@ -3,6 +3,8 @@
#include <QDebug>
#include <QPainter>
#include "colorscheme.hpp"
namespace chatterino {
namespace widgets {
@@ -16,7 +18,7 @@ RippleEffectButton::RippleEffectButton(BaseWidget *parent)
this->effectTimer.start();
}
void RippleEffectButton::setMouseEffectColor(QColor color)
void RippleEffectButton::setMouseEffectColor(boost::optional<QColor> color)
{
this->mouseEffectColor = color;
}
@@ -30,7 +32,13 @@ void RippleEffectButton::paintEvent(QPaintEvent *)
void RippleEffectButton::fancyPaint(QPainter &painter)
{
QColor &c = this->mouseEffectColor;
QColor c;
if (this->mouseEffectColor) {
c = this->mouseEffectColor.get();
} else {
c = this->colorScheme.isLightTheme() ? QColor(0, 0, 0) : QColor(255, 255, 255);
}
if (this->hoverMultiplier > 0) {
QRadialGradient gradient(mousePos.x(), mousePos.y(), 50, mousePos.x(), mousePos.y());
+4 -2
View File
@@ -1,5 +1,7 @@
#pragma once
#include <boost/optional.hpp>
#include "widgets/basewidget.hpp"
#include <QMouseEvent>
@@ -28,7 +30,7 @@ class RippleEffectButton : public BaseWidget
public:
RippleEffectButton(BaseWidget *parent);
void setMouseEffectColor(QColor color);
void setMouseEffectColor(boost::optional<QColor> color);
signals:
void clicked();
@@ -52,7 +54,7 @@ private:
double hoverMultiplier = 0.0;
QTimer effectTimer;
std::vector<ClickEffect> clickEffects;
QColor mouseEffectColor = {255, 255, 255};
boost::optional<QColor> mouseEffectColor = boost::none;
void onMouseEffectTimeout();
};
+1 -1
View File
@@ -21,7 +21,7 @@ RippleEffectLabel::RippleEffectLabel(BaseWidget *parent, int spacing)
this->hbox.addWidget(&this->label);
this->hbox.addSpacing(spacing);
this->setMouseEffectColor(QColor(255, 255, 255, 63));
// this->setMouseEffectColor(QColor(255, 255, 255, 63));
}
} // namespace widgets