#include#include int main() { QColor red(255, 0, 0); QColor darkRed = red.darker(50); QWidget widget; widget.setAutoFillBackground(true); widget.setStyleSheet("background-color: " + darkRed.name() + ";"); widget.show(); return 0; }
#includeIn this example, only the Qt Core library is used, as there is no GUI output.#include int main() { QColor green(120, 255, 255); QColor darkGreen = green.darker(75); qDebug() << "Original color:" << green.name(); qDebug() << "Darker color:" << darkGreen.name(); return 0; }