textColor() convenience method

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=742361
This commit is contained in:
Aaron J. Seigo 2007-11-27 21:56:47 +00:00
parent f63f585f1a
commit 3166344116
2 changed files with 14 additions and 2 deletions

View File

@ -21,10 +21,11 @@
#include <QFile> #include <QFile>
#include <KColorScheme>
#include <KConfigGroup>
#include <KDebug>
#include <KSharedConfig> #include <KSharedConfig>
#include <KStandardDirs> #include <KStandardDirs>
#include <kdebug.h>
#include <kconfiggroup.h>
namespace Plasma namespace Plasma
{ {
@ -157,6 +158,12 @@ KSharedConfigPtr Theme::colors() const
return d->colors; return d->colors;
} }
QColor Theme::textColor() const
{
KColorScheme colors(QPalette::Active, KColorScheme::View, Theme::self()->colors());
return colors.foreground(KColorScheme::NormalText).color();
}
} }
#include <theme.moc> #include <theme.moc>

View File

@ -96,6 +96,11 @@ class PLASMA_EXPORT Theme : public QObject
*/ */
Q_INVOKABLE KSharedConfigPtr colors() const; Q_INVOKABLE KSharedConfigPtr colors() const;
/**
* Returns the text color to be used by items resting on the background
*/
Q_INVOKABLE QColor textColor() const;
Q_SIGNALS: Q_SIGNALS:
/** /**
* Emitted when the user changes the theme. SVGs should be reloaded at * Emitted when the user changes the theme. SVGs should be reloaded at