from PyQt5.QtGui import QColor # Create a QColor object from a CMYK color cmyk_color = (0.5, 0.25, 0.75, 0.10) color = QColor.fromCmykF(*cmyk_color) # Print the RGB equivalent of the color print(color.red(), color.green(), color.blue()) # Output: 96 132 33
from PyQt5.QtGui import QColor # Create a list of CMYK colors cmyk_colors = [(0.0, 0.0, 0.0, 1.0), (0.1, 0.4, 0.7, 0.0), (0.8, 0.2, 0.0, 0.5)] # Create a list of QColor objects from the CMYK colors colors = [QColor.fromCmykF(*cmyk) for cmyk in cmyk_colors] # Print the RGB equivalents of the colors for color in colors: print(color.red(), color.green(), color.blue()) # Output: # 0 0 0 # 159 96 51 # 51 102 102This example creates a list of CMYK colors and uses list comprehension to create a list of QColor objects from them. The RGB equivalents of each color are then printed. The output shows the RGB components of each color.