QApplication app(argc, argv); QPalette customPalette; customPalette.setColor(QPalette::Window, Qt::black); customPalette.setColor(QPalette::WindowText, Qt::white); app.setPalette(customPalette);
QLabel label("Hello World!"); label.setAutoFillBackground(true); QPalette labelPalette = label.palette(); labelPalette.setColor(QPalette::Window, Qt::red); label.setPalette(labelPalette);These examples use the Qt library, which is a cross-platform application and UI framework. The QPalette class is part of the QtGui module within the Qt library.