QColor color(255, 0, 0); // creates a red color color.setRgb(0, 255, 0); // sets the color to green
QColor color(255, 255, 255); // creates a white color QString hexColor = color.name(); // converts the color to #FFFFFF format
QColor color(255, 0, 0); // creates a red color float hue, saturation, value; color.getHsvF(&hue, &saturation, &value); // gets the HSV values of the colorThese code examples use the QColor class from the Qt library.