Skip to content

Instantly share code, notes, and snippets.

@skyrpex
Last active October 5, 2022 10:57
Show Gist options
  • Save skyrpex/5547015 to your computer and use it in GitHub Desktop.
Save skyrpex/5547015 to your computer and use it in GitHub Desktop.
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
Copy link

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
Copy link

aedm commented Apr 13, 2015

This is awesome, thank you.

@YaseenTwati
Copy link

License ? :\

Copy link

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