Plasma colors

Sebastian Kuegler sebas at kde.org
Thu Feb 21 10:54:25 CET 2008


On Thursday 21 February 2008 09:44:44 Toussis Manolis wrote:
> Question #2:
>
> My applet uses two colors. One for text , and one for text highliting.
>
> For now it is just
> m_colfg = QColor(Qt::white);
> m_selcolfg = QColor(Qt::yellow)
>
> but I don't want to hardcode the colors.

Nobody wants that, indeed :-)

> I read the API to figure out how to read some acceptable colors from
> current plasma theme.
>
> I tried
> KColorScheme(QPalette::Active,KColorScheme::View).foreground(KColorScheme::
>ActiveForeground).color(); but it gives me black, the text color for the
> view for kde , NOT plasma. The thing is kde uses a view with white
> background so the text with color black is readable. Also the above ignores
> completelly the plasma theme

Correct. If you want to go through KColorScheme, you can use

KColorScheme plasmaColorTheme = KColorScheme(QPalette::Active,         
           KColorScheme::View, Plasma::Theme::self()->colors());

QColor inactiveColor = 
           plasmaColorTheme.foreground(KColorScheme::InactiveText).color();


> then I tried:
>    m_colfg = Plasma::Theme::self()->textColor();
> it gives me Black again, not readable in the blackbackground of plasma
> default theme.
>
> Any hints/ideas/code that I can use?

With the standard colorscheme those two

QColor text = Plasma::Theme::self()->textColor();
QColor background = lasma::Theme::self()->backgroundColor();

makes text white and background black. 


Which version of Plasma are you using?
-- 
sebas

 http://www.kde.org | http://vizZzion.org |  GPG Key ID: 9119 0EF9 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 481 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20080221/cad44f40/attachment.pgp 


More information about the Panel-devel mailing list