QColor blue(0, 0, 255);
QWidget* myWidget = new QWidget(); myWidget->setStyleSheet("background-color: blue"); // or myWidget->setStyleSheet(QString("background-color: %1").arg(blue.name()));
QPainter painter(myWidget); painter.fillRect(10, 10, 50, 50, blue);
QTextEdit* myTextEdit = new QTextEdit(); myTextEdit->setTextColor(blue);The QColor class is included in the QtCore package of the Qt framework.