use KColorScheme::shade(ShadowShade) for shadow colors

svn path=/trunk/KDE/kdebase/workspace/; revision=753940
This commit is contained in:
Matthew Woehlke 2007-12-28 19:40:15 +00:00
parent 47fe9e4956
commit 560d0809e8
2 changed files with 23 additions and 15 deletions

View file

@ -35,6 +35,8 @@
#include "plastikclient.h"
#include "misc.h"
#include <KColorScheme>
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);
}

View file

@ -36,6 +36,16 @@
#include "plastikbutton.h"
#include "misc.h"
#include <KColorScheme>
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();