diff --git a/clients/plastik/plastikbutton.cpp b/clients/plastik/plastikbutton.cpp index e340bbf2e1..624d55f65e 100644 --- a/clients/plastik/plastikbutton.cpp +++ b/clients/plastik/plastikbutton.cpp @@ -35,6 +35,8 @@ #include "plastikclient.h" #include "misc.h" +#include + namespace KWinPlastik { @@ -247,17 +249,15 @@ void PlastikButton::drawButton(QPainter *painter) dY++; } + QColor fontColor = Handler()->getColor(TitleFont,active); if(!isDown() && Handler()->titleShadow() ) { - QColor shadowColor; - if (qGray(Handler()->getColor(TitleFont,active).rgb()) < 100) - shadowColor = QColor(255, 255, 255, 75); - else - shadowColor = QColor(0,0,0,75); + QColor shadowColor = KColorScheme::shade(fontColor, KColorScheme::ShadowShade); + shadowColor.setAlphaF(shadowColor.alphaF() * 0.3); bP.setPen(shadowColor); bP.drawPixmap(dX+1, dY+1, icon); } - bP.setPen(Handler()->getColor(TitleFont,active) ); + bP.setPen(fontColor ); bP.drawPixmap(dX, dY, icon); } diff --git a/clients/plastik/plastikclient.cpp b/clients/plastik/plastikclient.cpp index 47299b85e8..61754d4426 100644 --- a/clients/plastik/plastikclient.cpp +++ b/clients/plastik/plastikclient.cpp @@ -36,6 +36,16 @@ #include "plastikbutton.h" #include "misc.h" +#include + +QColor alphaColor(QColor color, double alpha) +{ + if (alpha >= 1.0) + return color; + color.setAlphaF(qMax(0.0, alpha) * color.alphaF()); + return color; +} + namespace KWinPlastik { @@ -480,22 +490,20 @@ const QPixmap &PlastikClient::captionPixmap() const painter.setFont(s_titleFont); QPoint tp(1, captionHeight - 3); + QColor fontColor = Handler()->getColor(TitleFont,active); if(Handler()->titleShadow()) { - QColor shadowColor; - if (qGray(Handler()->getColor(TitleFont,active).rgb()) < 100) - shadowColor = QColor(255, 255, 255); - else - shadowColor = QColor(0,0,0); + QColor shadowColor = KColorScheme::shade(fontColor, KColorScheme::ShadowShade); - painter.setPen(alphaBlendColors(options()->color(ColorTitleBar, active), shadowColor, 205) ); + painter.setCompositionMode(QPainter::CompositionMode_SourceOver); + painter.setPen(alphaColor(shadowColor, 0.3) ); painter.drawText(tp+QPoint(1,2), c); - painter.setPen(alphaBlendColors(options()->color(ColorTitleBar, active), shadowColor, 225) ); + painter.setPen(alphaColor(shadowColor, 0.2) ); painter.drawText(tp+QPoint(2,2), c); - painter.setPen(alphaBlendColors(options()->color(ColorTitleBar, active), shadowColor, 165) ); + painter.setPen(alphaColor(shadowColor, 0.5) ); painter.drawText(tp+QPoint(1,1), c); } - painter.setPen(Handler()->getColor(TitleFont,active) ); + painter.setPen(fontColor ); painter.drawText(tp, c ); painter.end();