Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
- index aa4e224..b08fd7e 100644
- --- a/src/CMakeLists.txt
- +++ b/src/CMakeLists.txt
- @@ -7,6 +7,7 @@ SET(GTK-OXYGEN-SOURCES
- engine.cpp
- utilities.cpp
- colormapper.cpp
- + qcolorutils.cpp
- rcproperties.cpp)
- ADD_LIBRARY(oxygenengine SHARED ${GTK-OXYGEN-SOURCES})
- diff --git a/src/engine.cpp b/src/engine.cpp
- index 26b1bb7..73a484d 100644
- --- a/src/engine.cpp
- +++ b/src/engine.cpp
- @@ -28,6 +28,7 @@
- #include "dummyapplication.h"
- #include "utilities.h"
- #include "colormapper.h"
- +#include "qcolorutils.h"
- #include "rcproperties.h"
- #include <time.h>
- @@ -269,6 +270,11 @@ void Engine::drawButton(bool defaultButton)
- ENGINE_SETUP(QStyleOptionButton, QImage::Format_ARGB32, true, QPalette::Window)
- // Handle default buttons (ones that get activated when you press enter)
- option.features = defaultButton ? QStyleOptionButton::DefaultButton : QStyleOptionButton::None;
- +
- + // change palette button background color to deal with button position in main window
- + option.palette.setColor( QPalette::Button, QColorUtils::backgroundColor( option.palette.color( QPalette::Button ), m_topLeft.y(), m_toplevelSize.height() ) );
- +
- + // draw
- m_qtStyle->drawControl(QStyle::CE_PushButton, &option, &p, m_dummyButton);
- ENGINE_FINISH
- }
- @@ -995,17 +1001,41 @@ void Engine::drawOxygenBackground(bool draw)
- if (!image)
- {
- - QPalette palette(ColorMapper::mapGtkToQt(m_style, GTK_STATE_NORMAL, false));
- - QPalette::ColorGroup colorGroup = (m_state == GTK_STATE_INSENSITIVE) ? QPalette::Inactive : QPalette::Normal;
- - image = verticalGradient(palette.color(colorGroup, QPalette::Window), m_size.width(), m_size.height(), 0);
- -
- - QImage *rGradient = radialGradient(palette.color(colorGroup, QPalette::Window),\
- - m_size.width(), m_size.height());
- - QPainter p(image);
- + // create new image and make transparent
- + image = new QImage( m_size, QImage::Format_ARGB32);
- + image->fill( Qt::transparent );
- + QPainter p( image );
- +
- + // store palette, colorgroup and color locally
- + const QPalette palette(ColorMapper::mapGtkToQt(m_style, GTK_STATE_NORMAL, false));
- + const QPalette::ColorGroup colorGroup = (m_state == GTK_STATE_INSENSITIVE) ? QPalette::Inactive : QPalette::Normal;
- + const QColor color( palette.color( colorGroup, QPalette::Window ) );
- +
- + // the hard-coded metrics are copied for kdebase/workspace/libs/oxygen/oxygenhelper.cpp
- + const int gradientHeight = 64;
- + const int yShift = 23;
- + const int splitY( qMin(300, (3*m_size.height())/4 ) );
- + const QRect upperRect( 0, -yShift, m_size.width(), splitY);
- +
- + // draw upper linear gradient
- + QImage* vGradient( verticalGradient( color, m_size.width(), splitY, 0 ) );
- p.setCompositionMode(QPainter::CompositionMode_SourceOver);
- - p.drawImage(0, 0, *rGradient);
- - p.end();
- + p.drawImage( upperRect, *vGradient );
- + delete vGradient;
- +
- + // draw lower flat part
- + const QRect lowerRect(0, splitY - yShift, m_size.width(), m_size.height() - splitY + yShift );
- + p.fillRect( lowerRect, QColorUtils::backgroundBottomColor(color));
- +
- + // draw upper radial gradient
- + const int radialW( qMin(600, m_size.width() ) );
- + QRect radialRect( (m_size.width() - radialW) / 2, 0, radialW, gradientHeight);
- + radialRect.translate( 0, -yShift );
- + QImage* rGradient( radialGradient( color, radialW, gradientHeight ) );
- + p.drawImage( radialRect, *rGradient);
- delete rGradient;
- + p.end();
- +
- if (draw)
- {
- ENGINE_DRAW(true)
- @@ -1093,9 +1123,9 @@ QImage* Engine::verticalGradient(const QColor &color, int width, int height, int
- image->fill(Qt::transparent);
- QLinearGradient gradient(0, offset, 0, height + offset);
- - gradient.setColorAt(0.0, color.lighter(103));
- + gradient.setColorAt(0.0, QColorUtils::backgroundTopColor(color) );
- gradient.setColorAt(0.5, color);
- - gradient.setColorAt(1.0, color);
- + gradient.setColorAt(1.0, QColorUtils::backgroundBottomColor(color) );
- QPainter p(image);
- p.setCompositionMode(QPainter::CompositionMode_Source);
- @@ -1108,17 +1138,12 @@ QImage* Engine::verticalGradient(const QColor &color, int width, int height, int
- QImage* Engine::radialGradient(const QColor &color, int width, int height)
- {
- QImage *image = new QImage(width, height, QImage::Format_ARGB32);
- - int focalPoint = 350;
- image->fill(Qt::transparent);
- -
- - // Need to find something better, but i don't understand oxygen code
- - // Help wanted ;)
- - if (focalPoint > width / 2)
- - focalPoint = width / 2;
- - QColor radialColor = color.lighter(110);
- + QColor radialColor = QColorUtils::backgroundRadialColor(color);
- radialColor.setAlpha(255);
- - QRadialGradient gradient(width/2, 0, focalPoint);
- +
- + QRadialGradient gradient(64, height-64, 64);
- gradient.setColorAt(0, radialColor);
- radialColor.setAlpha(101);
- gradient.setColorAt(0.5, radialColor);
- @@ -1128,7 +1153,8 @@ QImage* Engine::radialGradient(const QColor &color, int width, int height)
- gradient.setColorAt(1, radialColor);
- QPainter p(image);
- - p.fillRect(QRect(0, 0, width, height), gradient);
- + p.scale(width/128.0,1);
- + p.fillRect(QRect(0,0,128,height), gradient);
- p.end();
- return image;
- diff --git a/src/qcolorutils.cpp b/src/qcolorutils.cpp
- new file mode 100644
- index 0000000..cfb6801
- --- /dev/null
- +++ b/src/qcolorutils.cpp
- @@ -0,0 +1,410 @@
- +/* This file is part of the KDE project
- + * Copyright ( C ) 2007 Matthew Woehlke <mw_triad@users.sourceforge.net>
- + * Copyright ( C ) 2007 Thomas Zander <zander@kde.org>
- + * Copyright ( C ) 2007 Zack Rusin <zack@kde.org>
- + *
- + * This library is free software; you can redistribute it and/or
- + * modify it under the terms of the GNU Library General Public
- + * License as published by the Free Software Foundation; either
- + * version 2 of the License, or ( at your option ) any later version.
- + *
- + * This library is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- + * Library General Public License for more details.
- + *
- + * You should have received a copy of the GNU Library General Public License
- + * along with this library; see the file COPYING.LIB. If not, write to
- + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- + * Boston, MA 02110-1301, USA.
- + */
- +
- +#include "qcolorutils.h"
- +#include <cmath>
- +
- +namespace QColorUtils
- +{
- +
- + //___________________________________________________________
- + // contrast
- + static qreal _contrast = 0.5;
- + static qreal _bgcontrast = 0.5;
- + void setContrast( qreal value )
- + {
- + _contrast = value;
- + _bgcontrast = qMin( 1.0, 0.9*_contrast/0.7 );
- + }
- +
- + //___________________________________________________________
- + const qreal& contrast( void )
- + { return _contrast; }
- +
- + //___________________________________________________________
- + const qreal& backgroundContrast( void )
- + { return _bgcontrast; }
- +
- + //____________________________________________________________________
- + bool lowThreshold(const QColor &color)
- + {
- +
- + const QColor darker( shade(color, MidShade, 0.5 ) );
- + return luma(darker) > luma(color);
- +
- + }
- +
- + //____________________________________________________________________
- + bool highThreshold(const QColor &color)
- + {
- + const QColor lighter( shade(color, LightShade, 0.5 ) );
- + return luma(lighter) < luma(color);
- + }
- +
- + //_________________________________________________________________________
- + QColor backgroundTopColor(const QColor &color)
- + {
- + if( lowThreshold(color) ) return shade(color, MidlightShade, 0.0);
- + else {
- + const qreal my( luma( shade(color, LightShade, 0.0) ) );
- + const qreal by( luma(color) );
- + return shade(color, (my - by) * backgroundContrast());
- + }
- +
- + }
- +
- + //_________________________________________________________________________
- + QColor backgroundBottomColor(const QColor &color)
- + {
- +
- + const QColor midColor( shade(color, MidShade, 0.0) );
- + if( lowThreshold(color) ) return midColor;
- + else {
- +
- + const qreal by( luma(color) );
- + const qreal my( luma(midColor) );
- + return shade(color, (my - by) * backgroundContrast());
- +
- + }
- + }
- + //_________________________________________________________________________
- + QColor backgroundRadialColor(const QColor &color)
- + {
- +
- + if( lowThreshold(color) ) return shade(color, LightShade, 0.0);
- + else if( highThreshold( color ) ) return color;
- + else return shade(color, LightShade, backgroundContrast() );
- + }
- +
- + //____________________________________________________________________
- + QColor backgroundColor(const QColor &color, int height, int y )
- + {
- +
- + qreal ratio( qreal(y)/qMin(300, 3*height/4) );
- + if( ratio < 0.5 )
- + {
- +
- + const qreal a( 2.0*ratio );
- + return mix(backgroundTopColor(color), color, a );
- +
- + } else {
- +
- + const qreal a( 2.0*ratio-1 );
- + return mix(color, backgroundBottomColor(color), a );
- +
- + }
- +
- + }
- +
- + //___________________________________________________________________
- + // luma coefficient
- + static const qreal yc[3] = { 0.2126, 0.7152, 0.0722 };
- +
- + //___________________________________________________________________
- + static inline qreal mixQreal( qreal a, qreal b, qreal bias )
- + { return a + ( b - a ) * bias; }
- +
- + //___________________________________________________________________
- + static inline qreal normalize( qreal a )
- + { return ( a < 1.0 ? ( a > 0.0 ? a : 0.0 ) : 1.0 ); }
- +
- + //___________________________________________________________________
- + static inline qreal gamma( qreal n )
- + { return pow( normalize( n ), 2.2 ); }
- +
- + //___________________________________________________________________
- + static inline qreal igamma(qreal n)
- + { return pow(normalize(n), 1.0/2.2); }
- +
- + //___________________________________________________________________
- + static inline qreal wrap( qreal a, qreal d = 1.0 )
- + {
- + qreal r = fmod( a, d );
- + return ( r < 0.0 ? d + r : ( r > 0.0 ? r : 0.0 ) );
- + }
- +
- + //___________________________________________________________________
- + // hcy representation of a colors
- + class HCY
- + {
- +
- + public:
- +
- + //! constructor
- + HCY( const QColor& color )
- + {
- +
- + // transparency
- + a = color.alphaF();
- +
- + // luma component
- + y = luma( color );
- +
- + qreal r = gamma( color.redF() );
- + qreal g = gamma( color.greenF() );
- + qreal b = gamma( color.blueF() );
- +
- + // hue component
- + qreal p = qMax( qMax( r, g ), b );
- + qreal n = qMin( qMin( r, g ), b );
- + qreal d = 6.0 * ( p - n );
- + if( n == p ) h = 0.0;
- + else if( r == p ) h = ( ( g - b ) / d );
- + else if( g == p ) h = ( ( b - r ) / d ) + ( 1.0 / 3.0 );
- + else h = ( ( r - g ) / d ) + ( 2.0 / 3.0 );
- +
- + // chroma component
- + if( r == g && g == b ) c = 0.0;
- + else c = qMax( ( y - n ) / y, ( p - y ) / ( 1 - y ) );
- +
- + }
- +
- + //! convert back to color
- + QColor qColor() const
- + {
- + // start with sane component values
- + qreal _h = wrap( h );
- + qreal _c = normalize( c );
- + qreal _y = normalize( y );
- +
- + // calculate some needed variables
- + qreal _hs = _h * 6.0, th, tm;
- + if( _hs < 1.0 )
- + {
- +
- + th = _hs;
- + tm = yc[0] + yc[1] * th;
- +
- + } else if( _hs < 2.0 ) {
- +
- + th = 2.0 - _hs;
- + tm = yc[1] + yc[0] * th;
- +
- + } else if( _hs < 3.0 ) {
- +
- + th = _hs - 2.0;
- + tm = yc[1] + yc[2] * th;
- +
- + } else if( _hs < 4.0 ) {
- +
- + th = 4.0 - _hs;
- + tm = yc[2] + yc[1] * th;
- +
- + } else if( _hs < 5.0 ) {
- +
- + th = _hs - 4.0;
- + tm = yc[2] + yc[0] * th;
- +
- + } else {
- +
- + th = 6.0 - _hs;
- + tm = yc[0] + yc[2] * th;
- +
- + }
- +
- + // calculate RGB channels in sorted order
- + qreal tn, to, tp;
- + if( tm >= _y )
- + {
- +
- + tp = _y + _y * _c * ( 1.0 - tm ) / tm;
- + to = _y + _y * _c * ( th - tm ) / tm;
- + tn = _y - ( _y * _c );
- +
- + } else {
- +
- + tp = _y + ( 1.0 - _y ) * _c;
- + to = _y + ( 1.0 - _y ) * _c * ( th - tm ) / ( 1.0 - tm );
- + tn = _y - ( 1.0 - _y ) * _c * tm / ( 1.0 - tm );
- +
- + }
- +
- + // return RGB channels in appropriate order
- + if( _hs < 1.0 ) return QColor::fromRgbF( igamma( tp ), igamma( to ), igamma( tn ), a );
- + else if( _hs < 2.0 ) return QColor::fromRgbF( igamma( to ), igamma( tp ), igamma( tn ), a );
- + else if( _hs < 3.0 ) return QColor::fromRgbF( igamma( tn ), igamma( tp ), igamma( to ), a );
- + else if( _hs < 4.0 ) return QColor::fromRgbF( igamma( tn ), igamma( to ), igamma( tp ), a );
- + else if( _hs < 5.0 ) return QColor::fromRgbF( igamma( to ), igamma( tn ), igamma( tp ), a );
- + else return QColor::fromRgbF( igamma( tp ), igamma( tn ), igamma( to ), a );
- + }
- +
- + qreal h;
- + qreal c;
- + qreal y;
- + qreal a;
- +
- + };
- +
- + //___________________________________________________________________
- + qreal luma( const QColor &color )
- + {
- +
- + // RGB ratios
- + return
- + gamma( color.redF() )*yc[0] +
- + gamma( color.greenF() )*yc[1] +
- + gamma( color.blueF() )*yc[2];
- + }
- +
- + //___________________________________________________________________
- + qreal contrastRatio( const QColor &c1, const QColor &c2 )
- + {
- + qreal y1 = luma( c1 ), y2 = luma( c2 );
- + if( y1 > y2 ) return ( y1 + 0.05 ) / ( y2 + 0.05 );
- + else return ( y2 + 0.05 ) / ( y1 + 0.05 );
- + }
- +
- + //___________________________________________________________________
- + QColor lighten( const QColor &color, qreal ky, qreal kc )
- + {
- + HCY c( color );
- + c.y = 1.0 - normalize( ( 1.0 - c.y ) * ( 1.0 - ky ) );
- + c.c = 1.0 - normalize( ( 1.0 - c.c ) * kc );
- + return c.qColor();
- + }
- +
- + //___________________________________________________________________
- + QColor darken( const QColor &color, qreal ky, qreal kc )
- + {
- + HCY c( color );
- + c.y = normalize( c.y * ( 1.0 - ky ) );
- + c.c = normalize( c.c * kc );
- + return c.qColor();
- + }
- +
- + //___________________________________________________________________
- + static inline QColor tintHelper( const QColor &base, const QColor &color, qreal amount )
- + {
- + HCY result( mix( base, color, pow( amount, 0.3 ) ) );
- + result.y = mixQreal( luma( base ), result.y, amount );
- +
- + return result.qColor();
- + }
- +
- + //___________________________________________________________________
- + QColor tint( const QColor &base, const QColor &color, qreal amount )
- + {
- + if( amount <= 0.0 ) return base;
- + if( amount >= 1.0 ) return color;
- + if( isnan( amount ) ) return base;
- +
- + double ri = contrastRatio( base, color );
- + double rg = 1.0 + ( ( ri + 1.0 ) * amount * amount * amount );
- + double u = 1.0, l = 0.0;
- + QColor result;
- + for ( int i = 12 ; i ; --i )
- + {
- +
- + double a = 0.5 * ( l+u );
- + result = tintHelper( base, color, a );
- + double ra = contrastRatio( base, result );
- + if( ra > rg ) u = a;
- + else l = a;
- +
- + }
- +
- + return result;
- +
- + }
- +
- + //___________________________________________________________________
- + QColor mix( const QColor &c1, const QColor &c2, qreal bias )
- + {
- + if( bias <= 0.0 ) return c1;
- + if( bias >= 1.0 ) return c2;
- + if( isnan( bias ) ) return c1;
- +
- + qreal r = mixQreal( c1.redF(), c2.redF(), bias );
- + qreal g = mixQreal( c1.greenF(), c2.greenF(), bias );
- + qreal b = mixQreal( c1.blueF(), c2.blueF(), bias );
- + qreal a = mixQreal( c1.alphaF(), c2.alphaF(), bias );
- +
- + return QColor::fromRgbF( r, g, b, a );
- + }
- +
- +
- + //___________________________________________________________________
- + QColor shade(const QColor &color, ShadeRole role)
- + { return shade(color, role, _contrast ); }
- +
- + //___________________________________________________________________
- + QColor shade(const QColor &color, ShadeRole role, qreal contrast, qreal chromaAdjust)
- + {
- +
- + // nan -> 1.0
- + contrast = (1.0 > contrast ? (-1.0 < contrast ? contrast : -1.0) : 1.0);
- + qreal y = luma(color), yi = 1.0 - y;
- +
- + if (y < 0.006)
- + {
- +
- + // handle very dark colors (base, mid, dark, shadow == midlight, light)
- + switch (role)
- + {
- +
- + case LightShade: return shade(color, 0.05 + 0.95 * contrast, chromaAdjust);
- + case MidShade: return shade(color, 0.01 + 0.20 * contrast, chromaAdjust); case DarkShade: return shade(color, 0.02 + 0.40 * contrast, chromaAdjust);
- + default: return shade(color, 0.03 + 0.60 * contrast, chromaAdjust);
- +
- + }
- +
- + } else if (y > 0.93) {
- +
- + // handle very light colors (base, midlight, light == mid, dark, shadow)
- + switch (role)
- + {
- +
- + case MidlightShade: return shade(color, -0.02 - 0.20 * contrast, chromaAdjust);
- + case DarkShade: return shade(color, -0.06 - 0.60 * contrast, chromaAdjust);
- + case ShadowShade: return shade(color, -0.10 - 0.90 * contrast, chromaAdjust);
- + default: return shade(color, -0.04 - 0.40 * contrast, chromaAdjust);
- +
- + }
- +
- + } else {
- +
- + // handle everything else
- + qreal lightAmount = (0.05 + y * 0.55) * (0.25 + contrast * 0.75);
- + qreal darkAmount = ( - y ) * (0.55 + contrast * 0.35);
- + switch (role)
- + {
- + case LightShade: return shade(color, lightAmount, chromaAdjust);
- + case MidlightShade: return shade(color, (0.15 + 0.35 * yi) * lightAmount, chromaAdjust);
- + case MidShade: return shade(color, (0.35 + 0.15 * y) * darkAmount, chromaAdjust);
- + case DarkShade: return shade(color, darkAmount, chromaAdjust);
- + default: return darken(shade(color, darkAmount, chromaAdjust), 0.5 + 0.3 * y);
- + }
- +
- + }
- +
- + }
- +
- + //___________________________________________________________________
- + QColor shade( const QColor &color, qreal ky, qreal kc )
- + {
- + HCY c( color );
- + c.y = normalize( c.y + ky );
- + c.c = normalize( c.c + kc );
- + return c.qColor();
- + }
- +
- +
- +}
- diff --git a/src/qcolorutils.h b/src/qcolorutils.h
- new file mode 100644
- index 0000000..f2d3b9f
- --- /dev/null
- +++ b/src/qcolorutils.h
- @@ -0,0 +1,110 @@
- +#ifndef qcolorutils_h
- +#define qcolorutils_h
- +
- +/*
- + * Copyright (C) 2010 Hugo Pereira Da Costa <hugo@oxygen-icons.org>
- + *
- + * copied from kdelibs/kdeui/color/kcolorutils.h
- + * Copyright (C) 2007 Matthew Woehlke <mw_triad@users.sourceforge.net>
- + * Copyright (C) 2007 Thomas Zander <zander@kde.org>
- + * Copyright (C) 2007 Zack Rusin <zack@kde.org>
- + *
- + * This library is free software; you can redistribute it and/or
- + * modify it under the terms of the GNU Library General Public
- + * License as published by the Free Software Foundation; either
- + * version 2 of the License, or (at your option) any later version.
- + *
- + * This library is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- + * Library General Public License for more details.
- + *
- + * You should have received a copy of the GNU Library General Public License
- + * along with this library; see the file COPYING.LIB. If not, write to
- + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- + * Boston, MA 02110-1301, USA.
- + */
- +
- +#include <QColor>
- +
- +/*
- + * A set of methods used to work with colors.
- + */
- +namespace QColorUtils
- +{
- +
- + //! set contrast values
- + void setContrast( qreal );
- +
- + //! contrast
- + const qreal& contrast( void );
- +
- + //! background contrast
- + const qreal& backgroundContrast( void );
- +
- + //!@name color utilities
- + //@{
- + bool lowThreshold( const QColor& );
- + bool highThreshold( const QColor& );
- + QColor backgroundTopColor( const QColor& );
- + QColor backgroundBottomColor( const QColor& );
- + QColor backgroundRadialColor( const QColor& );
- +
- + //! returns menu background color matching position in a top level widget of given height
- + QColor backgroundColor(const QColor &color, int height, int y);
- +
- + //@}
- +
- + /*!
- + Calculate the luma of a color. Luma is weighted sum of gamma-adjusted
- + R'G'B' components of a color. The result is similar to qGray. The range
- + is from 0.0 (black) to 1.0 (white).
- + */
- + qreal luma(const QColor&);
- +
- + /*!
- + Calculate the contrast ratio between two colors, according to the
- + W3C/WCAG2.0 algorithm, (Lmax + 0.05)/(Lmin + 0.05), where Lmax and Lmin
- + are the luma values of the lighter color and the darker color,
- + respectively.
- + */
- + qreal contrastRatio(const QColor&, const QColor&);
- +
- + //! Adjust the luma of a color by changing its distance from white.
- + QColor lighten(const QColor&, qreal amount = 0.5, qreal chromaInverseGain = 1.0);
- +
- + //! Adjust the luma of a color by changing its distance from black.
- + QColor darken(const QColor&, qreal amount = 0.5, qreal chromaGain = 1.0);
- +
- + //! Create a new color by tinting one color with another
- + QColor tint(const QColor &base, const QColor &color, qreal amount = 0.3);
- +
- + //! mix two colors
- + QColor mix(const QColor &c1, const QColor &c2, qreal bias = 0.5);
- +
- + enum ShadeRole
- + {
- +
- + // The light color is lighter than dark() or shadow() and contrasts with the base color.
- + LightShade,
- +
- + // The midlight color is in between base() and light().
- + MidlightShade,
- +
- + // The mid color is in between base() and dark().
- + MidShade,
- +
- + // The dark color is in between mid() and shadow().
- + DarkShade,
- +
- + // The shadow color is darker than light() or midlight() and contrasts the base color.
- + ShadowShade
- +
- + };
- +
- + QColor shade(const QColor&, ShadeRole);
- + QColor shade(const QColor&, ShadeRole, qreal contrast, qreal chromaAdjust = 0.0);
- + QColor shade(const QColor&, qreal lumaAmount, qreal chromaAmount = 0.0);
- +}
- +
- +#endif
- diff --git a/src/rcproperties.cpp b/src/rcproperties.cpp
- index a41c000..be7eb2e 100644
- --- a/src/rcproperties.cpp
- +++ b/src/rcproperties.cpp
- @@ -26,6 +26,7 @@
- #include "utilities.h"
- #include "rcproperties.h"
- #include "engine.h"
- +#include "qcolorutils.h"
- #include <QtDebug>
- #include <QToolTip>
- @@ -225,6 +226,9 @@ void RcProperties::setColorProperties()
- mapColor("text[INSENSITIVE]", QPalette::Disabled, QPalette::Text);
- mapColor("base[INSENSITIVE]", QPalette::Disabled, QPalette::Base);
- + // Contrast
- + QColorUtils::setContrast( qreal( kdeConfigValue("/share/config/kdeglobals", "KDE/contrast", 0.5, true ).second.toInt() )/10 );
- +
- // Tooltips
- QColor tooltipBg(convertColor(kdeConfigValue("/share/config/kdeglobals", "Colors:Tooltip/BackgroundNormal", QToolTip::palette().color(QPalette::Active, QPalette::Base), true).second));
- QColor tooltipFg(convertColor(kdeConfigValue("/share/config/kdeglobals", "Colors:Tooltip/ForegroundNormal", QToolTip::palette().color(QPalette::Active, QPalette::Text), true).second));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement