Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Qt5 Fusion style (dark color palette)
qApp->setStyle(QStyleFactory::create("fusion"));
QPalette palette;
palette.setColor(QPalette::Window, QColor(53,53,53));
palette.setColor(QPalette::WindowText, Qt::white);
palette.setColor(QPalette::Base, QColor(15,15,15));
palette.setColor(QPalette::AlternateBase, QColor(53,53,53));
palette.setColor(QPalette::ToolTipBase, Qt::white);
palette.setColor(QPalette::ToolTipText, Qt::white);
palette.setColor(QPalette::Text, Qt::white);
palette.setColor(QPalette::Button, QColor(53,53,53));
palette.setColor(QPalette::ButtonText, Qt::white);
palette.setColor(QPalette::BrightText, Qt::red);
palette.setColor(QPalette::Highlight, QColor(142,45,197).lighter());
palette.setColor(QPalette::HighlightedText, Qt::black);
qApp->setPalette(palette);
@songziming

This comment has been minimized.

Copy link

@songziming songziming commented Jan 21, 2015

How about adding rules for disabled texts, like:

palette.setColor(QPalette::Disabled, QPalette::Text, Qt::darkGray);
palette.setColor(QPalette::Disabled, QPalette::ButtonText, Qt::darkGray);
@aedm

This comment has been minimized.

Copy link

@aedm aedm commented Apr 13, 2015

This is awesome, thank you.

@YaseenTwati

This comment has been minimized.

Copy link

@YaseenTwati YaseenTwati commented Jun 20, 2015

License ? :\

@ghost

This comment has been minimized.

Copy link

@ghost ghost commented Sep 9, 2015

@eltii The code is under WTFPL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment